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

Tell if Stop-Process was successful or not in PowerShell

Currently I start processes in PowerShell like this: $proc = Start-Process notepad -Passthru $proc | Export-Clixml -Path (Join-Path $ENV:temp 'processhandle.xml') to later on kill it like this: $proc = Import-Clixml -Path (Join-Path $ENV:temp…
Maxim V. Pavlov
  • 10,303
  • 17
  • 74
  • 174
1
vote
1 answer

msp file through powershell cmdlet

I am trying to silently install a windows fabric patch file (.msp) with powershell. I tried this : $argumentCU1 = "/i "+ '"' + $execCU1 +'"' + " /quiet" Write-Host $argumentCU1 (Start-Process -FilePath msiexec.exe -ArgumentList $argumentCU1 -wait…
mlaribi
  • 699
  • 1
  • 10
  • 18
1
vote
2 answers

Start-Process Filepath with Variable in Button.add_click won't work as expected

Second question today but this time I believe there's something really strange going on. The following code is not my original, I tried to reproduce the behavior with as few lines as possible. In my original code I'm importing the application paths…
1
vote
1 answer

Using a $Variable to Submit -Filepath Argument for Start-Process

I'm using PowerShell Version 3. I have a weird problem I would like to fix. I've written a PowerShell script which reads a config CSV file (with application paths and names) and creates a form with application buttons. When I try to submit the…
ddl
  • 29
  • 4
1
vote
0 answers

Impersonating User into remote machine

I want to start User Interactive process on a computer in my network. I know administrative credentials of that machine.But as I learned to start User Interactive process, I need to acquire parent session running on that machine(session0).I am not…
Kaustubh_Kharche
  • 725
  • 3
  • 13
  • 34
1
vote
1 answer

Start-Process cannot execute psexec.exe

I have working script that use Invoke-Expression to execute psexec in Powershell ISE <# $password is encrypted password, need to unencrypt to pass it to psexec #> $bstr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($password) $str…
Glowie
  • 2,271
  • 21
  • 60
  • 104
1
vote
3 answers

Powershell start-process -wait parameter fails in remote script block

So here's a sample of what I'm trying to do: Invoke-Command [Connection Info] -ScriptBlock { param ( [various parameters] ) Start-Process [some .exe] -Wait } -ArgumentList [various parameters] It connects to the other machine…
ndarwincorn
  • 19
  • 2
  • 8
1
vote
2 answers

start-process in PowerShell 3.0 script doesn't work but it was working in 2.0

I upgraded our PS version to 3.0 and some of our scripts stopped working. After a lot of debugging I realized there is an issue with the Start-Process command. Basically, when I run the Start-Process directly in the PowerShell cmd it does run the…
Sandra
  • 175
  • 1
  • 2
  • 11
1
vote
1 answer

How to pass parameters to batch in powershell

I have a problem with my PowerShell script. I am trying to check the emails received in my inbox. When an email arrives to the inbox, the script calls a batch file that saves some of the data of the email received in a database. Everything is…
Liz Barraza
  • 133
  • 1
  • 7
1
vote
2 answers

Powershell - Start-Process to launch hello world is not working

I am trying to figure out how to run powershell script with elevated credentials, and was told the best way to do this was with Start-Process And this website,…
Glowie
  • 2,271
  • 21
  • 60
  • 104
1
vote
1 answer

How do I pass literal path to Start-process in PowerShell?

Here I have a PowerShell script which opens all jpg files in a folder in mspaint to save them. It repairs exif thumbs and lessens file size. The problem is that it can't send mspaint jpg files which have spaces in their paths. So how do I make…
Tiivi Taavi
  • 85
  • 2
  • 14
0
votes
1 answer

Can I start an application from .NET but not give it focus?

I'd like my application to start another (3rd party) application, but without giving it focus. The 3rd party application is a GUI application, so it will create windows, etc - and that's fine, I want them - but my application should still stay in…
Vilx-
  • 104,512
  • 87
  • 279
  • 422
0
votes
2 answers

Powershell: Scripted Remote Installation using Start-Process of Notepad++ hangs indefinitely

I have written a script, that takes a csv file with vulnerable Servers and should replace the installed version of Notepad++. I uninstall the currently installed version from the machine, push a installer into the C:\ Directory of the machine and…
0
votes
0 answers

PowerShell based GUI form not loading ( Closing with a Flash) when called from Other PowerShell wrapper compiled in EXE through IExpress

I am currently working on creating a GUI-based application that involves calling Start-Process with specific parameters. The application works as expected when executed in both PowerShell.exe and ISE. However, I am encountering a problem when…
cri ron
  • 1
  • 2
0
votes
2 answers

How to call C .exe file from C#?

I have an .exe file which was written in C. It is a command line application. I want give command line and also get correspond output in this application through a C# application. How do I invoke the command and get the output from C#?
hmlasnk
  • 1,160
  • 1
  • 14
  • 33