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

PowerShell Invoke-Command with Start-Process access denied

I have a script that has this code: $secpasswd = ConvertTo-SecureString "Ukn545454" -AsPlainText -Force $mycreds = New-Object System.Management.Automation.PSCredential ("$env:USERDOMAIN\user1", $secpasswd) invoke-command -ComputerName "MyW10comp"…
Lior
  • 139
  • 2
  • 13
2
votes
1 answer

Powershell Removing Quotes Argument

I'm using Start-Process to start another instance of Powershell as an administrator but when I try to pass the argument list, whether as a variable or as a plain string, Powershell removes the quotes. Below is the command I'm using: $argu = '-noexit…
dkneeland
  • 80
  • 7
2
votes
1 answer

Launch msiexec as an admin through powershell

I'm having trouble with a piece of code that I'm trying to get working in regards to executing an MSI application. I need to pass credentials that are stored in a variable and then pass those credentials through a "runas" to the MSI package so that…
2
votes
2 answers

How to run a program as another user and add arguments in powershell?

We have a program that only updates when being run with the switch /t from an administrator account. I came up with the CMD prompt version, but I'm new to powershell and having a hard time translating it to Powershell. The CMD version…
da64u
  • 21
  • 1
  • 3
2
votes
1 answer

RDP into server with specific username

I need to be able to call the exe and specify the servername and username only. I still want it to prompt for the password like normal. When I call the first command below the RDP will prompt me for my password, but it already has my local username…
CuriousOne
  • 922
  • 1
  • 10
  • 26
2
votes
1 answer

How to start and stop processes in PowerShell?

This should work fine in PowerShell older than 3. I need to run two processes: wuapp.exe and desk.cpl with ScreenSaver's tab. The problem I have is that once I start wuapp.exe the process name shows up in Task Manager as explorer.exe - the current…
ppiotrek
  • 55
  • 2
  • 2
  • 8
2
votes
1 answer

Why is Powershell returning no ExitCode on Windows 7

I'm trying to write a script to install software on many computers. The problem is, they have to be installed in specific order and I need to know that the first installation succeeded before running the second one. here's the important…
chrosey
  • 220
  • 3
  • 15
2
votes
1 answer

Ignoring powershell script failure for a particular line

I have a powershell script that defines $ErrorActionPreference = "Stop" But i also have a start-process call that target a process that returns a non-standard exit code on success (1 instead of 0). As a result of this, the script is failing even…
John-Philip
  • 3,392
  • 2
  • 23
  • 52
2
votes
2 answers

teamcity powershell - unable to run batch file

I've spent quite a bit of time banging my head on this one. A little StackOverflow help please, good folks! Scenario: We are trying to run a custom .bat file located on the CI server via the TeamCity Powershell step. When powershell script is run…
ECD
  • 21
  • 4
2
votes
1 answer

PowerShell - script 1 calls script 2 - how to return value from script 2 to script 1

I have two PowerShell scripts. One script invokes another PowerShell script using elevated credentials, using Start-Process. But I am struggling with how to make the second script return the output value to the first script. Here is script # 1,…
Glowie
  • 2,271
  • 21
  • 60
  • 104
2
votes
2 answers

How to Start a Process Without Losing Focus

I am starting a new process using the following code: Dim procStartInfo As New ProcessStartInfo Dim procExecuting As New Process With procStartInfo .FileName = "C:\PTL\Bin\xxxxxx.exe" .WindowStyle =…
Matt Wilko
  • 26,994
  • 10
  • 93
  • 143
1
vote
5 answers

Powershell Remote Invoke-Command Start-Process App Immediately Closes After Launch

I am working on a script to remotely kill two processes, delete some folders, and launch a service as an application. Eventually this will be deployed to run against multiple servers, but I'm currently testing it against a single server. Everything…
1
vote
3 answers

"The directory name is invalid" error on Process.Start?

I am writing a launcher program, and when I go to start the process I get the "The directory name is invalid" error. Here is the code that is launching the process: Const DEBUG_ROOT = _…
Anders
  • 12,088
  • 34
  • 98
  • 146
1
vote
1 answer

Trying to get a command to run in cli from a powershell script but it is picking up an "ambiguous" parameter

I am currently trying to get a command that I know works in CLI to run through a PowerShell Ise script but it will not allow me to run it as it is picking up a part of the command as a parameter. I tried to run the following command, but it brings…
1
vote
3 answers

Silent install of IBM Rational Doors 9.7 with Powershell

I am trying to perform a silent install of IBM Rational Doors 9.7 as explained here. I want to perform the install with Powershell. I am constructing the arguments to Start-Process to run the installer like this: $doors97installArgs = '/s…
Juan Jimenez
  • 443
  • 4
  • 18