Question

Is there any way to remotely query the events on 2003 server thru Powershell. Get-eventlog doesn't have a -credential switch and get-winevent doesn't work on Server 2003.

I even tried the impersonation module. It works with commands like get-service, get-process, get-counter but not with get-wmiobject or get-eventlog. Am I missing something.

Was it helpful?

Solution

You are probably looking for this:

Get-WmiObject Win32_NTLogEvent -ComputerName $compName -Credential $cred

gm results of Get-WmiObject for Win32_NTLogEvent (yes, it can take a while to produce):

enter image description here

You can use for filtering (i.e. add -filter "(TimeWritten>'$BeginDate')" to gwmi command), don't forget to assign $BeginDate variable prior to that. See these:

OTHER TIPS

Wrap your Get-EventLog command within an Invoke-Command script block.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top