Reputation: 702
Running this command from a cygwin window fails because powershell cant find object, "Get-EventLog":
echo "\n" | powershell.exe Get-EventLog System | Where-Object { $_.EventID -match "6009" }
The Get-EveneLog Systerm query work just fine from a Powershell console so I know it's not a syntax issue. And I have included the powershell path.
Any Ideas?
Upvotes: 1
Views: 2867
Reputation: 151
powershell.exe -command 'Get-EventLog System | Where-Object { $_.EventID -match "6009" }'
Upvotes: 0
Reputation: 702
After a brief trial and error session I discovered that if the query is encased in single quotes it will work :
powershell.exe 'Get-EventLog System | Where-Object { $_.EventID -match "6009" }'
Upvotes: 2