PowerShell Start-Process. System.Diagnostics.Process.
> $proc = Start-Process pslist -NoShellExecute
However, while it returns a Process object , it does not allow redirecting the output to execution. To do this, you can create your own process and execute it by first changing ProcessStartInfo :
> $proc = New-Object System.Diagnostics.Process
> $proc.StartInfo = New-Object System.Diagnostics.ProcessStartInfo("pslist.exe")
> $proc.StartInfo.CreateNoWindow = $true
> $proc.StartInfo.UseShellExecute = $false
> $proc.StartInfo.RedirectStandardOutput = $true
> $proc.Start()
> $proc.StandardOutput.ReadToEnd()
source
share