Created
June 24, 2018 22:04
-
-
Save nickgarvey/8dcaf761dca9d85a666fce3fbfe2434b to your computer and use it in GitHub Desktop.
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
| #$global:last_time = 0 | |
| $restart = { | |
| #$i = $Args.NewEvent.Properties['TIME_CREATED'] | |
| Stop-Process -processname notepad | |
| notepad | |
| $s = Out-String -InputObject $Args.NewEvent.Properties | |
| Write-Host $s | |
| Remove-Event -SourceIdentifier asdf | |
| } | |
| Register-WmiEvent -Action $restart -Query "SELECT * FROM Win32_DeviceChangeEvent WHERE EventType = 2" -SourceIdentifier asdf | |
| Wait-Event asdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment