document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. # Code Snippet from aperturescience.su
  2. # Parameters
  3.  
  4. # Body
  5.  
  6. $emailbody = "The server has just been restarted. Relevant Windows Event log entries:`n"
  7. $emailbody += "------------------------------------------------------------------------`n"
  8.  
  9. $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))}
  10.  
  11.  
  12. foreach ($entry in $entries)
  13. {
  14.     $emailbody += $entry.timecreated
  15.     $emailbody += $entry.Message
  16.     $emailbody +="`n"
  17. }
  18.  
  19. send-email $emailbody $true
  20.  
  21. # Code Snippet from aperturescience.su
');