Questions tagged [start-process]

Start-Process is a PowerShell cmdlet that starts one or more processes on the local computer.

Start-Process is a PowerShell cmdlet that starts one or more processes on the local computer. To specify the program that runs in the process, enter an executable file or script file, or a file that can be opened by using a program on the computer. If you specify a non-executable file, Start-Process starts the program that is associated with the file, much like the Invoke-Item cmdlet.

You can use the parameters of Start-Process to specify options, such as loading a user profile, starting the process in a new window, or using alternate credentials.

Output

  • None or System.Diagnostics.Process
    When you use the PassThru parameter, Start-Process generates a System.Diagnostics.Process. Otherwise, this cmdlet does not return any output.
255 questions
1
vote
0 answers

How to refer a variable inside the argument list of power shell start-process command?

this is a relatively simple script. I am passing some parameters to a script as variables and I want to use them in the start-process command. So I need to refer to the variables in the argument list of start-process command. Here are the parameters…
Himanshu Sarmah
  • 346
  • 1
  • 2
  • 12
1
vote
1 answer

Powershell Script how to run multiple lines of code in new powershell window with start-process

I have a basic menu script with options to show info regarding a specific Computer, users are prompted for domain admin rights and Computername (Computername is saved in $ComputerName) when the script is started, and that works as intended. All the…
NLB
  • 15
  • 3
1
vote
1 answer

How to pass "y" to pscp process started with PowerShell Start-Process?

I would like to pscp some files from Windows to Linux server. The following code (PowerShell) is what I was trying. It worked fine, but I need to input y, when it's trying to communicate with remote server, cause the hostname is unknown for…
Corey
  • 1,217
  • 3
  • 22
  • 39
1
vote
0 answers

Powershell Start-Process with Credentials runs forever

I have an issue with the start-process command in Powershell, when using the -credentials parameter the Powershell_ISE is running forever, it never finishes. The issue seems to be on one server though, so when i run it on this specific server…
1
vote
2 answers

Prepend a command in Start-Process to provide "y" input to Plink

I saw a solution to cache a server host key by adding the command just below on the top of my script before running the other Plink tasks. & "echo y | C:\Program Files\PuTTY\plink.exe" -ssh -batch -i $PrivateKeyPath $username "exit" 2>&1 Error…
Alex_P
  • 2,580
  • 3
  • 22
  • 37
1
vote
1 answer

How to pass argument to Start-Process

I'd like to run this command net start "PTV LOXANE xDataServer 1.4.1.067" using Start-Process in powershell with admin rights. My problem is how to give the quote to ArgumentList. I've tried this but it doesn't work Start-Process net -ArgumentList…
Lohiki
  • 41
  • 6
1
vote
1 answer

Take Screenshot with Firefox

I'm having a heck of a time figuring out why this simple command is not working. I'm attempting to take screenshots of a list of domains using PowerShell and Firefox per [this article][1]. Currently I have the following code, but it does not produce…
Duck
  • 91
  • 7
1
vote
0 answers

Can't get Driver Updates to silently install

I am having trouble getting my Driver Update .exe files to install silently using powershell. I've been tasked with remotely installing critical driver updates on a bunch of laptops. I've stored all the driver updates on a local repository and I am…
joshm
  • 11
  • 3
1
vote
1 answer

How to start multiple process in PowerShell

How does one start a process or program simultaneously? Such as to open 5 notepads with one cmdlet?
WebsGhost
  • 107
  • 1
  • 14
1
vote
1 answer

Powershell Start-Process cmdlet not working from within a TFS Powershell script

VS / TFS 2017 This post was updated to reflect new information There are 2 PowerShell scripts: p1.ps1 p2.ps1 p1 is executed as a PowerShell task in a TFS build process. p2 is used twice within p1. Use 1: p2 is called from p1, meaning p2 is…
Alan
  • 1,587
  • 3
  • 23
  • 43
1
vote
2 answers

Wait for all child processes to finish

Currently I am trying to run a script multiple times and let the parent wait for all the child processes to finish. The creation of the children is as follows: # Spawn balance load processes $command = "-i $ScriptPath\balanceLoaders\%BALANCE_DIR% -o…
Patrick Rennings
  • 191
  • 1
  • 5
  • 19
1
vote
1 answer

Process started with PowerShell Start-Process using Python's Paramiko exec_command is not working although it is working fine from SSH terminal

I want to execute a Python script as Administrator. I'm using the following command to do so: powershell Start-Process python -ArgumentList "C:\Users\myuser\python_script.py","-param1", "param1","-param2","param2" -Verb "runAs" This command works…
gradole
  • 89
  • 11
1
vote
0 answers

Start-Process cmd does not work with Credential parameter when invoked from AWS Cloudformation template

I am creating an EC2 instance on AWS using Cloudformation template. As part of that template i am invoking a powershell script which performs the below steps (the script performs other tasks as well, but the below lines cause the error) $MyFolder =…
1
vote
1 answer

ExitCode from Batchfile is weird

I'm trying to run a batch file from a powershell script and check if there has been any error during the runtime. Right now, I'm doing it by the following code: $job = Start-Process -FilePath "C:\Test\Testfile_2.bat" -Wait…
Twinfriends
  • 1,972
  • 1
  • 14
  • 34
1
vote
1 answer

Start-Process passing a hashtable in the ArgumentList

Consider the following situation: Content MyScript.ps1: Param ( [String]$CountryCode, [String]$FilesPath, [String]$KeepassDatabase, [String]$KeepassKeyFile, [String]$EventLog = 'HCScripts', [String]$EventSource, …
DarkLite1
  • 13,637
  • 40
  • 117
  • 214