Kill a process launched from a powershell script if it doesn't complete
hello,
i have powershell script launches external .exe like so:
& c:\path executable\program.exe | out-null
usually that's sufficient needs, program.exe errors , pops error message requires user click ok before script continues. in order around issue, have following logic:
start-sleep -s 60 if (get-process program -ea silentlycontinue) { stop-process -processname program perform error handling steps }
$proc = start-process "c:\path executable\program.exe" -passthru
if (!$proc.waitforexit(60000)) {$proc.kill()}
Windows Server > Windows PowerShell
Comments
Post a Comment