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
2 answers

How to pass a variable to new console window in Powershell

I want to pass a variable to a new console, but I don't know how. $server = "server_name" Start-Process Powershell { $host.ui.RawUI.WindowTitle = “Get-Process” Invoke-Command -ComputerName $server -ScriptBlock { Get-Process …
elpe
  • 33
  • 2
2
votes
1 answer

With PowerShell, how to switch minimized application to normal state?

Given a single-instance desktop application ccTest.exe, how can I use PowerShell (v6 or 7) to run the application in the Normal state if it is already running in Minimized state. I need access to controls in the main window so it must be in Normal…
cefeg
  • 33
  • 7
2
votes
0 answers

Powershell - How to use Start-Process to call file from share/pass args in single line

To preface this, I am self teaching and brand new to scripting in general, let alone powershell. After a cumulative 12 hours, my Google fu has run out. I had a series of programs tailored to different models of computer we support that ran a staged…
Mungle
  • 21
  • 1
2
votes
4 answers

Why does pwsh.exe in combination with Start-Process not accept a script block directly?

Why does Start-Process powershell.exe { Read-Host } work, but Start-Process pwsh.exe { Read-Host } does not? I'm aware of the -ArgumentList switch of Start-Process, but it makes things more complicated when it comes to escaping quotation…
2
votes
1 answer

Application doesn't get triggered from Powershell script, when invoking inside Do...Until

I am trying to build custom Windows System Utility script which offers some tasks with relevant keypress choices. For cleanup task, I am trying to invoke CCleaner64.exe from this script, with it's correct switches as mentioned here. And the script I…
Vicky Dev
  • 1,893
  • 2
  • 27
  • 62
2
votes
1 answer

Start-Process inside start-process as different user

I'm trying to pass arguments from an installshield setup file, what am I doing wrong ? $STExecute = "C:\Files\setup.exe" $STArgument = '/s /f2"c:\windows\setuplogs\inst.log"' Start-Process Powershell.exe -Credential "Domain\userTempAdmin"…
BenDK
  • 131
  • 2
  • 7
2
votes
1 answer

Can't hit breakpoint in program.main Blazor Client wasm

Create a basic Blazor App, I'm trying to debug the main/start method of my app. Mainly to check the objects I'm injecting and primarily getting the configurations from appsettings.json. I've also added the in lauchSettings.json the json setting for…
Carlo Luther
  • 2,402
  • 7
  • 46
  • 75
2
votes
3 answers

RedirectStandardError $logFile with Append?

I have a PowerShell script where I use Start-Process and redirect output to a log file. The cmd is in a for loop, and I'd like to have the output append each time it runs. Right now it wipes out the log file each time it runs. Is there a way to…
Paul Wasserman
  • 137
  • 2
  • 13
2
votes
2 answers

Question about using PowerShell Select-String, exiftool(-k)

In a PowerShell script I'm trying to filter the output of the exiftool(-k).exe command below, using Select-String. I've tried numerous permutations, but none work, and I always see the unfiltered output. What do I need to do to filter the output…
zBernie
  • 97
  • 2
  • 10
2
votes
1 answer

Why can't I use Start-Process to invoke a script with parameters?

I am trying to write a wrapper script in Powershell which is passed the name of an executable, does some preprocessing, then invokes that executable with arguments resulting from that preprocessing. I want the executable to be anything you can…
Chris Nelson
  • 3,519
  • 7
  • 40
  • 51
2
votes
1 answer

Run PowerShell script in PowerShell 6 from C#

I have a PowerShell script which communicates with a REST server. This script only works in PowerShell 6. I want to call it from C#, because the C# program needs the info from the REST server, and I don't want to rewrite the REST code in C#. So…
Finni
  • 429
  • 5
  • 17
2
votes
1 answer

How to start a 32-bit process in C# without using shell execute on 64-bit machine?

I have an ASP .NET web application on a 64-bit machine that needs to run a legacy 32-bit reporting application. When I run the program with UseShellExecute = false, the program exits with exit code: -1073741502 I can't use Shell Execute because I…
Ryan
  • 2,948
  • 3
  • 30
  • 41
2
votes
0 answers

Timeout on Start-Process

I'm trying to run process via powershell script on windows startup. Unforturnately, PC on which I running it is slow. In most of cases the Start-Process method "crashes" with message This command cannot be executed due to the error: The service did…
Hawex
  • 133
  • 13
2
votes
1 answer

Powershell Start-Process works but not from .ps1 script

If I paste this into Powershell blue window it runs fine and launches the program Start-Process “C:\Program Files (x86)\Engine Pro\engine.exe” -ArgumentList "#21#”; but if I try to run the same command in a script, run.ps1 script, that launches…
Kurt L.
  • 623
  • 10
  • 23
2
votes
1 answer

How to pass parameters as part of -file in PowerShell

If I run this line in a PowerShell window, it executes perfectly .\buildTestAndPublish.ps1 -buildPath 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0' -testPath 'C:\Program Files (x86)\Microsoft Visual…
MyDaftQuestions
  • 4,487
  • 17
  • 63
  • 120