Monitor Process

From psadt | Evergreen Application Management
Jump to navigation Jump to search

About

Powershell.png

Useful in cases where the setup.exe spawns multiple setup.exe's and each exits. So this checks for any processes named setup and waits 10 seconds and checks again to avoid the script ending early and failing detection.


Function

$i = 0
	do
	{

	$i++
	$processRtn = Get-Process | Where { $_.name -like '*setup*' }

	$processRtn | Select *

	Write-Host $("Waiting for process to finish" + $i.ToString())

	Start-Sleep -Seconds 10

	}while ($processRtn -ne $Null)