Advertisement
gocha

Get-EventLog (eventquery.vbs alternative)

Jan 30th, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Something like `eventquery.vbs /l application /FI "Datetime ge DATETIMESTR" /v`
  2.  
  3. Get-EventLog Application | Where-Object { $_.TimeGenerated -ge [DateTime]"2014/01/31 09:00:00" } | Sort-Object TimeGenerated | Format-Table -AutoSize -Property EntryType, InstanceID, TimeGenerated, Source, Machinename, Category, UserName, Message | Out-String -Width 4096 -Stream | %{ $_.TrimEnd() }
  4.  
  5. # When you run "powershell -c", PowerShell will do auto-wrapping unless you attach the following statement at first.
  6. # It will attach a long scrollbar to your console. Use Out-File instead, if possible...
  7. $host.UI.RawUI.BufferSize = new-object System.Management.Automation.Host.Size(4096, 256);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement