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

Passing a Scriptblock with complex Arguments to a New Powershell Instance

I want to execute the following script with complex arguments. For example with [securestring]. $text = "'This is a test message.'" $ArgumentList = @( $text, $PID ) -join ", " $cmd = { param([string]$msg, [int]$proc ); Write-Host "$msg FROM PID:…
0
votes
0 answers

Start-Process ArgumentList parameter not working

I try to install .msu package using Poweshell. My code: $Args = @(('"' + $Path_Temp + '\' + $Hotfix[1] + '.msu' + '"'), '/norestart') echo $Args Start-Process -FilePath ($Env:SystemRoot + '\System32\wusa.exe') -ArgumentList $Args -Verb RunAs…
user3600124
  • 829
  • 1
  • 7
  • 19
0
votes
1 answer

Is it possible to have -RedirectStandardOutput in Start-Process but still display it in the console?

My problem is that I want to Start-Process a powershell file, execute.ps1, that would execute several sql commands then log the outputs in a text file. So far, all the other approaches like start-transcript or *>> just writes the console outputs but…
Pa3k.m
  • 994
  • 2
  • 7
  • 22
0
votes
1 answer

Powershell start-process : combinaison Credential/WorkingDirectory fail

I'm using powershell to start process as another user. To do this I'm using "Start-Process" as below. $creds = Get-Credential -UserName $Name -Message "Please enter authorized credentials" Start-Process ` -Credential $creds ` …
0
votes
1 answer

Powershell script using start-process and piping out-file to text file, not working, produces blank text file

This is my first question on SO so here goes! I'm getting started with a simple powershell script that I intend to use to benchmark some archiving software. I want to run the archiver (7-zip on Windows 10 in this case) and write the console output…
Zcehtro
  • 33
  • 1
  • 7
0
votes
1 answer

Powershell: Start-Process with an argument

I want to start a setup.exe with one install parameter => /download example.xml When I tpye in "C:\Temp\folder\setup.exe /download example.xml" in Windows Explorer Address Bar the setup.exe starts correctly. How do I do that with Powershell? I've…
user18209625
  • 139
  • 2
  • 15
0
votes
0 answers

PowerShell: waiting for output redirect file to unlock after killing process

I have a PowerShell script that: Starts a new process and redirects the output to two files Waits with a timeout for the process to complete Kills the process if it timed out Reads the contents from the redirected output files It looks something…
Jordan
  • 3,998
  • 9
  • 45
  • 81
0
votes
0 answers

cmd batch start-process powershell file and occur abnormal handling in cmd batch

I have a big question for me. In my situation, I have a cmd batch file and Powershell file. And the cmd batch script will call to Powershell file to process. The question is "if the Powershell file is running and appear an abnormal case, e.g. Due to…
user11343272
  • 77
  • 1
  • 1
  • 9
0
votes
0 answers

Web browser control opens outside of "Parent form" when URL is included (vb.net)

I have a small application that allows an external app to behave like a child form and open up in another form. the code to do so is as follows Dim myfile As String = (Application.StartupPath & "\MyHelp.exe") …
LabRat
  • 1,996
  • 11
  • 56
  • 91
0
votes
0 answers

How to pass variable in Scriipt Block for use with Invoke-Command that will call an executable that takes the variable as switch param

I am attempting to create a generic script that will process registry files on a list of remote servers. The script will take the input of the path/filename to process and a list of servers to process it on. Copies the .reg file to the remote server…
0
votes
0 answers

Powershell Start-Process the filename or extension is too long

I've a error message while using credentials in start-process with a encrypted password file. In my oppinion the start-process argument credentials cannot handle the length of the encrypted password file. I tested the code with a convertion of the…
Seb
  • 3
  • 2
0
votes
0 answers

Console windows collapse on using Start-Process dotnet.exe

I have written a PowerShell script to launch few webjobs in my local machine. My script is working fine and is launching each webjob in a new console window as expected. However, the issue I am facing is that if there is some problem with the…
0
votes
0 answers

Suppress 'The variable is assigned but never used', when cache Start-Process Handle

Is it possible to hide the PSScriptAnalyzer messeage in Visual studio code "The variable is assigned but never used" ? I tried with: [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUserDeclaredVarsMoreThanAssignments')] But then the handle is…
BenDK
  • 131
  • 2
  • 7
0
votes
1 answer

redirect keyboard input from called process to calling program

I am using start-process to call vlc to play an audio file. I want to capture the keyboard input of this vlc process. Pressed keys should not be passed to vlc but to my calling program, such that I can check using $host.UI.RawUI.KeyAvailable or…
jamacoe
  • 519
  • 4
  • 16
0
votes
1 answer

Start-Process Issues running WsusUtil.exe

I have a really simple issue that I can't seem to figure out... I have a powershell script to update WSUS data and then export it so I can burn it to CD for our secure environment, everything works great, except running the wsusutil.exe I get an…