Powershell Uninstall using WMIC

I have a requitrment to uninstall a suite of applications using WMIC. Initially I wanted to use the below script

$ObjApp = Get-WmiObject win32_product -filter "IdentifyingNumber = '$FindAppbyGUID'" -namespace root/cimv2

 If ($ObjApp.Uninstall().ReturnValue -eq 0)
    Write-Host  "Uninstall SUCCESSFULL"
    Write-Host "Uninstall FAILED"

For whatever reason this application will not uninstall with the above code neither via msiexec /X /qn etc etc.
However the application will uninstall with below WMIC command ...

wmic product where identifyingnumber="{AAAA00A0-BB11-22CC-D333-4E4444E44444}" call uninstall

My method of running this in powershell is ...

$Cmd = "wmic product where identifyingnumber="{AAAA00A0-BB11-22CC-D333-4E4444E44444}" call uninstall"
Invoke-Expression $Cmd

I also tried ...
$Cmd = 'wmic product where identifyingnumber="{AAAA00A0-BB11-22CC-D333-4E4444E44444}" call uninstall'
Invoke-Expression $Cmd

Any Help will be appreciated.

Thank You in Advance
ukpowoActive Directory ConsultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
The last one looks correct - what's the result?
ukpowoActive Directory ConsultantAuthor Commented:
The error message I get is ...
wmic : Unexpected switch at this level.
At line:1 char:1
+ wmic product where identifyingnumber="{63B5DA5A-477B-438D-A6A0-118787 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Unexpected switch at this level.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
There are some issues with the ticks/quotes when running inside of PowerShell. And the Invoke-Command is not required. This should work:
wmic product where identifyingnumber="'{AAAA00A0-BB11-22CC-D333-4E4444E44444}'" call uninstall

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.