C0ppert0p
C0ppert0p

Reputation: 702

running powershell via cygwin

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

Answers (2)

Proxx
Proxx

Reputation: 151

powershell.exe -command 'Get-EventLog System | Where-Object { $_.EventID -match "6009" }'

Upvotes: 0

C0ppert0p
C0ppert0p

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

Related Questions