Search code examples
powershellpowershell-2.0event-log

powershell 2.0 unable to get Internet Explorer logs


When I try to run cmd get-eventlog -list on win2003 std in powershell V2.0. It gives me the following output

 Max(K) Retain OverflowAction        Entries Log
 ------ ------ --------------        ------- ---
 16,384      0 OverwriteAsNeeded         117 Application
 512      7 OverwriteOlder              0 Internet Explorer
 20,480      0 OverwriteAsNeeded           0 Microsoft-Windows-Forwarding/Operational
 16,384      0 OverwriteAsNeeded         136 Security
 16,384      0 OverwriteAsNeeded         173 System
 15,360      0 OverwriteAsNeeded          83 Windows PowerShell

When try to run get-eventlog "Internet Explorer", it gives me Error

Get-EventLog : No matches found
At line:1 char:13
+ get-eventlog <<<<   $event
    + CategoryInfo          : ObjectNotFound: (:) [Get-EventLog], ArgumentException
    + FullyQualifiedErrorId : GetEventLogNoEntriesFound,Microsoft.PowerShell.Commands.GetEventLogCommand

Can someone help me resolve the issue?


Solution

  • You are getting the exception because it's empty, BUT you can still get the object by doing this:

    $ieLog = get-eventlog -list | where-object {$_.Log -eq "Internet Explorer"}
    

    To verify that you really did get the correct log, try writing something in there:

    $ieLog.Source = "Testing"
    $ieLog.WriteEntry("Write Succeeded")