watchdog-vm/watchdog-wow.ps1

18 lines
365 B
PowerShell

$WATCHDOG=0
for (;;) {
$NRESP = Get-Process | Where-Object {$_.mainWindowTitle} | Where -Property MainWindowTitle -eq "World of Warcraft" | Where -Property Responding -eq $false
if ($NRESP) {
$WATCHDOG += 1
} else {
$WATCHDOG = 0
}
if ($WATCHDOG -ge 5) {
Stop-Process -InputObject $NRESP
}
Start-Sleep 60
}