Created
October 10, 2019 18:06
-
-
Save MarioBinder/a3f0bd87d8b6fb95fb3866f366b9a531 to your computer and use it in GitHub Desktop.
script for monitoring chrome
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $target = "chrome" | |
| $process = Get-Process | Where-Object {$_.ProcessName -eq $target} | |
| while ($true) | |
| { | |
| while (!($process)) | |
| { | |
| $process = Get-Process | Where-Object {$_.ProcessName -eq $target} | |
| start-sleep -s 5 | |
| } | |
| if ($process) | |
| { | |
| "Chrome is running" | |
| $process.WaitForExit() | |
| start-sleep -s 2 | |
| $process = Get-Process | Where-Object {$_.ProcessName -eq $target} | |
| "Chrome is shutting down" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment