user3281582
user3281582

Reputation: 21

PowerShell Issue

get-eventlog -LogName system -ComputerName servername | where {$_.source -eq "user32"} | select -first 1 | Format-List

The above command does not return back to the prompt after displaying the desired result.

This happens only in the case of remote computers. If I use "localhost" it works just fine.

Upvotes: 0

Views: 68

Answers (1)

JasonMArcher
JasonMArcher

Reputation: 15011

I think what you are running into is that Select-Object can kill the pipeline locally in PSv3, but it can't do that remotely. So you continue to get results until it is finished. Since your conditions mean that you will filter out all but one result, it seems like it is hanging.

Try removing the Select-Object (and maybe the Where-Object) to see how long it takes to run normally. You should also do more filtering in the remote call itself rather than filter after receiving the data.

Get-EventLog -LogName system -Source "user32" | select -first 1 | Format-List

Upvotes: 1

Related Questions