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
3
votes
1 answer

Passing variable arguments using PowerShell's Start-Process cmdlet

Good evening everyone, I'm using a command line that passes arguments to as variables in the following scripts to be run in another ps1 that I'm calling from within this script. Whenever I try to pass the arguments from the command line I get the…
Mike
  • 133
  • 2
  • 4
  • 13
3
votes
1 answer

Process.start () throwing error while trying to run as administrator

I have an application developed in vb.net which needs administrator privileges. I have set level = "requireAdministrator" in the application manifest. My client wants this application to be run by a local user due to some restrictions in their…
MaliCMT
  • 31
  • 3
3
votes
3 answers

Start-Process -Wait Not Working

I have powershell script that calls another .exe file. Start-Process ".\file.exe" -wait file.exe is a simple windows with some message and has one only button to close the the .exe. This is the first line in the main script runs. I want to wait and…
Imsa
  • 1,105
  • 2
  • 17
  • 39
3
votes
1 answer

PowerShell Start-Process -redirectStandardOutput throws: The system cannot find the file specified

In a PowerShell window I am executing: Start-Process XXXXX.exe -ArgumentList "some valid arguments" -wait -redirectStandardOutput "D:\\test1.txt" And getting: Start-Process : This command cannot be executed due to the error: The system cannot find…
RichyRoo
  • 31
  • 1
  • 1
  • 4
3
votes
1 answer

Start-Process with alternative credential in a remote session

all, I believe this scenario sounds indeed odd, but I do need your help on this. First I use Enter-PSSession -ComputerName myComputerName -Credential domain\user1 to remote to a third machine from my dev machine. I got a prompt like…
3
votes
2 answers

Powershell start-process script calls a second script - how to make one script only

I have a powershell script that accepts parameters in the form of "sender-ip=10.10.10.10" and that runs perfectly with elevated credentials #script.ps1 $userID=$NULL $line_array = @() $multi_array = @() [hashtable]$my_hash = @{} foreach ($i in…
Glowie
  • 2,271
  • 21
  • 60
  • 104
2
votes
1 answer

Powershell ArgumentList with string

I want to run a powershell process with a command list. I'm having an issue with using a string in an argumentlist with a command list. This is what I try to run: Start-Process Powershell -ArgumentList '-command "$var = "test""' But it results…
miket2000
  • 23
  • 3
2
votes
0 answers

How to start unique windows for running paralell instances of a program in Powershell, with input file?

I want to write a powershell script that opens unique instances of the same program, with input arguments to it. But my problem is when I use the example code below - the xml-file is opened in the same program window. Not in unique windows. So,…
StefanK
  • 31
  • 1
2
votes
2 answers

PowerShell, [Console]::KeyAvailable generates error when running as a background task

Instead of using pause in scripts, it is useful to me to make a script auto-exit after a set time. This is particularly useful to me as various of these scripts can run interactively or as a background task with Start-Process -WindowStyle Hidden…
YorSubs
  • 3,194
  • 7
  • 37
  • 60
2
votes
3 answers

PowerShell, test the performance/efficiency of asynchronous tasks with Start-Job and Start-Process

I'm curious to test out the performance/usefulness of asynchronous tasks in PowerShell with Start-ThreadJob, Start-Job and Start-Process. I have a folder with about 100 zip files and so came up with the following test: New-Item "000" -ItemType…
2
votes
1 answer

Preserve environment variables using Start-Process

I'll start with saying that am new to Powershell. I'm currently trying to figure out how to set an environment variable in Windows 11 using the Start-Process cmdlet. I've already tried both with admin privileges and without. This is what I'm…
2
votes
1 answer

PowerShell Script - Run multiple executables in parallel and wait for all launched executables to terminate before proceeding

I have an executable file (.exe) which has to be run multiple times with different arguments in parallel (ideally on different cores) from a PowerShell script, and at the end wait for all launched executables to terminate. To implement that in my…
2
votes
0 answers

Is Start-Process -Passthru unable to grab the process ID?

I have a PowerShell script able to open and close .txt and .exe via a returned PID from Start-process $type -Passthru. However, if I try to do this same thing with .pngs I get this error: Start-Process : This command cannot be run completely…
2
votes
2 answers

Powershell start-process running windows explorer does not wait

I have a PS script to monitor a logging file for a specific list of servers in the network. If the script logic finds the issue I'm monitoring for, I want to interrupt the script process with a launch and wait of windows explorer for the related…
Michael
  • 45
  • 5
2
votes
0 answers

Launching Powershell with PS1 filepath as variable

I have a Powershell Gui that populates all PS1 files in a specific folder. This GUI is intended for a easy way to execute any one of those scripts in their own PS window. Here is my issue. Test.ps1 write-host "Hello World" pause Script that…
DeadLink
  • 93
  • 12