Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. $getEventLog = Get-EventLog -log application -ComputerName "myRemoteName" -after ((get-date).addMinutes($minutes*-1)) -EntryType Error
  2. Write-Host Get-Eventlog completed
  3.  
  4. # list of events to exclude (based on text found in the message)
  5. $getEventLogFiltered = $getEventLog | Where-Object {$_.Message -notlike 'Monitis*' -and $_.Message -notlike '*MQQueueDepthMonitor.exe*' -and $_.Message -notlike '*The local computer may not have the necessary registry*' }
  6. #to only select certain columns, use Select-Object -Property and list the property/columns
  7. $getEventLogColumns = $getEventLogFiltered | Select-Object -Property TimeGenerated,Source,Message,EntryType,MachineName,EventID
  8. $tableFragment = $getEventLogColumns | ConvertTo-Html -fragment
  9. Write-Host "HTML-Table Built"
  10.  
  11. Updates 03/04/2014 13:40 CT:
  12. Running with $minutes = 120 ran 14.5 minutes.
  13. Running with $minutes = 1 ran 12.5 minutes.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement