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.
204 questions
7
votes
3 answers

How to start remotely process in PowerShell

I have a problem, I have a script which: Connect with PSSession (I use PSSession with admin account) Stop 2 process Do change on them files Start the 2 process (Problem here) I want to start process on server, so i'm connect with PSSession (No…
Servuc
  • 336
  • 1
  • 5
  • 16
6
votes
1 answer

redirect stdout, stderr from powershell script as admin through start-process

Inside a powershell script, I'm running a command which starts a new powershell as admin (if I'm not and if needed, depending on $arg) and then runs the script. I'm trying to redirect stdout and stderr to the first terminal. Not trying to make…
Soleil
  • 4,891
  • 3
  • 27
  • 47
6
votes
1 answer

PowerShell Executing a function within a Script Block using Start-Process does weird things with double quotes

I have a PowerShell script that edits the registry, so it needs to run as admin. To do this, I start up a new PowerShell process from my running PowerShell script, and pass in part of the registry key path using a Script Block with a function in it.…
deadlydog
  • 19,009
  • 14
  • 91
  • 101
5
votes
2 answers

Remotely zipping files with PowerShell start-process and invoke-command

I want to be able to remote into a system and zip or unzip files there and have the process signal when it is complete. Start-process works with the -wait parameter to run 7z.exe synchronously from PowerShell. When I try to combine that with…
What Would Be Cool
  • 4,551
  • 4
  • 42
  • 41
5
votes
1 answer

Powershell Start-Process : This command cannot be executed due to the error: Access is denied

I'm trying to run start-process from a powershell script with given credential. Nevertheless the command fail with the following error: Start-Process : This command cannot be executed due to the error: Access is denied Here is the full error…
John-Philip
  • 2,838
  • 2
  • 20
  • 48
5
votes
5 answers

Powershell Start-Process msiexec on a remote machine not working

For some reason Start-Process msiexec won't work when run through invoke command on a remote machine. I looked it up and while some people recommend using psiexec i have seen a lot of people using the plain old invoke-command to start msi installers…
5
votes
5 answers

Powershell Start-Process to start Powershell session and pass local variables

Is there a way to use the Powershell Start-Process cmdlet to start a new Powershell session and pass a scriptblock with local variables (once of which will be an array)? Example: $Array = @(1,2,3,4) $String = "This is string number" $Scriptblock =…
atownson
  • 338
  • 2
  • 9
  • 20
4
votes
2 answers

Issues with running a PsExec process from code

I am experiencing a weird issue when attempting to run a .NET command line tool remotely using PsExec. When running PsExec from command line, it runs and completes fine. When running it from a console application (creating a process, running…
lysergic-acid
  • 17,990
  • 18
  • 96
  • 194
4
votes
1 answer

Process.start does not find file when useshellexecute = false

I need to call batch-files from my UWP Application. The way to do seems to be Process.Start(), but it says it does not find the file even tough it is definitly there when I follow the path it outputs. Filepath and Working Directory are both given…
Mika
  • 65
  • 4
4
votes
1 answer

Convert string to PSCustomObject

The problem I'm having stems from passing a PSCustomObject as an argument to the Start-Process cmdlet (I'm essentially starting a new PowerShell process to run a script asynchronously from the calling script). Although the parameter is defined as…
Harry
  • 177
  • 3
  • 15
4
votes
4 answers

Is there a way to pass serializable objects to a PowerShell script with start-process?

I know about PowerShell jobs, but I want to use start-process and pass a serializable object to the new powershell process. Is there any way to do this? It seems that using start-process you have to provide a string argument list which won't cut it…
Kirk Liemohn
  • 7,203
  • 7
  • 43
  • 50
4
votes
1 answer

Elevate creditals with powershell via Local System Account

I want to deploy code using powershell via Jenkins Job. This works fine in the powershell ise. $username = "mydomain\builder" $password = "notmypassword" $credentials = New-Object System.Management.Automation.PSCredential -ArgumentList…
paul rockerdale
  • 327
  • 5
  • 18
4
votes
4 answers

Powershell Using Start-Process in PSSession to Open Notepad

I've created a pssession on a remote computer and entered that possession. From within that session I use start-process to start notepad. I can confirm that notepad is running with the get-process command, and also with taskmgr in the remote…
Colyn1337
  • 1,443
  • 2
  • 17
  • 27
4
votes
1 answer

Powershell Start-Process ignored in remote session

I am starting a new process using: $removeArguments = "-Command `"&{import-module .\deploy-utility.psm1; RemoveSolutions -solutionNames $solutionNames -url $url;}`"" start-process powershell -ArgumentList $removeArguments -Wait This works fine…
3
votes
5 answers

Process.Start filename using %temp%

For some odd reaseon this code fails: p.StartInfo.FileName = @"%temp%\SSCERuntime_x86-ENU.msi"; and this code succes: p.StartInfo.FileName = @"C:\Users\USERNAME\AppData\Local\Temp\SSCERuntime_x86-ENU.msi"; Is there any reason I am missing? Note I…
Diego
  • 15,566
  • 24
  • 79
  • 132
1
2
3
13 14