EDIT 9/26/2011: Still looking for an answer, if you have any ideas please post and let me know!
Summary of problem
When I run Get-EventLog against my own computer or a nearby computer, I don't see anything unusual and everything works as expected.
When I run it against a computer that is further away (average ping of 108ms
) it starts to act in a way that I wouldn't expect. There is a long pause between each event that is returned, and it takes an excessively long time to complete.
Here is the command I am using:
Get-EventLog -ComputerName [computername] -LogName Application -newest 100
I would expect the command to gather all the information on the remote computer and then send it back to me in one bunch, but it doesn't seem to be doing this.
When I execute the command normally and use something like online-stopwatch for rough measurements, the result is about 4 minutes and 3 seconds.
When I measure it using:
Measure-Command {Get-EventLog -ComputerName yanhong03 -LogName Application -newest 100}
The result is about 31 seconds (but none of the information is printed out).
So, two questions:
- Why are events (seemingly) retrieved one at a time?
- Why is using Measure-Command actually changing the amount of time the command takes to finish?
Miscellaneous Details:
I am running powershell v2, and am using the shell in the Powershell ISE for executing these commands. OS is Windows XP.