basketcase

If Event ID Exists

Sep 19th, 2010
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $evtIDs = (3,5,1074)
  2. $evtIDProperties = Get-EventLog -LogName System | where {$evtIDs -contains $_.EventID} | fl -Property *
  3. $noevtIDs = "No Event ID's exist"
  4. $countEvtID = (Get-EventLog -LogName System | where {$evtIDs -contains $_.EventID}).count
  5.  
  6. if ($countEvtID){$evtIDProperties}
  7. else{ Write-host $noevtIDs}
Add Comment
Please, Sign In to add comment