Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Code Snippet from aperturescience.su
- # Parameters
- # Body
- $emailbody = "The server has just been restarted. Relevant Windows Event log entries:`n"
- $emailbody += "------------------------------------------------------------------------`n"
- $entries = Get-WinEvent -logname system -MaxEvents 5000 -ErrorAction SilentlyContinue | Where-Object {((($_.id -eq 12) -or ($_.id -eq 13)) -and ($_.providername -eq "Microsoft-Windows-Kernel-General")) -or ($_.providername -eq "USER32") -or (($_.providername -eq "Microsoft-Windows-Kernel-Power") -and ($_.id -eq 41))}
- foreach ($entry in $entries)
- {
- $emailbody += $entry.timecreated
- $emailbody += $entry.Message
- $emailbody +="`n"
- }
- send-email $emailbody $true
- # Code Snippet from aperturescience.su
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement