locked
Getting event logs takes a very long time RRS feed

  • Question

  • Hi,

    I just started using PowerShell and was trying to hang around Windows Event logs.

    When i try to run this command, it gives me the out put right away but the screen just hangs i.e. i checked in ISE the the script keeps running for say 2 minutes if i don't stop it manually.

    Get-EventLog System -After(Get-Date).AddDays(-1)

    Can any one help me out with this issue? Am I missing something here which is causing the command to continue even after giving the output??

    Monday, July 3, 2017 2:11 PM

All replies

  • If you have a lot of records it will take a long time to output;

    This will be much faster:

    $events = Get-WinEvent -FilterHashTable @{Logname='System';Starttime=[datetime]::Today.AddDays(-1)}


    \_(ツ)_/

    Monday, July 3, 2017 7:43 PM