I have to do some powershell script modifications which I cannot test properly on my dev machine.
Thats why I would like to know, if I can use an OR
-Operator in my Get-WmiObject -filter
operation?
Currently we use
(Get-WmiObject -Class Win32_Product -Filter "Name like 'ApplicationName1 Client%'" ...).Uninstall()
But lately we renamed the name of the application from ApplicationName1
to NewName
. Thats why I would like to add another condition like this:
(Get-WmiObject -Class Win32_Product -Filter "Name like 'ApplicationName1 Client%' OR Name like 'NewName Client%'" ...).Uninstall()
My question would be:
Is this a valid syntax for the filter or would this throw an exception / give an error? If it gives an error, how would you do this?