NobleMan
NobleMan

Reputation: 515

adding second filter condition produces error

As soon as put in the -and command, I get an error. I know it has to do with the syntax but google is not providing me with anything that worked.

gwmi -namespace Root\cimv2 -class win32_product -impersonation 3 -Filter { Name like "%Microsoft Visual C++ 2008 Redistributable - x86%" -and Version -eq "9.0.30729.6161"}

Upvotes: 0

Views: 26

Answers (1)

Mathias R. Jessen
Mathias R. Jessen

Reputation: 175085

With Get-WmiObject, the -Filter parameter expects you to use WQL (WMI Query Language) syntax - -eq and -and or not valid WQL operators:

Get-WmiObject -Filter 'Name LIKE "%Microsoft Visual C++ 2008 Redistributable - x86%" AND Version = "9.0.30729.6161"' -namespace Root\cimv2 -class win32_product -impersonation 3

Upvotes: 2

Related Questions