Hi, Guys.
I’m having trouble getting a remote application to uninstall from a server. I’ve looked at a couple different ways of doing this, but I don’t want to use Win32_Product. Which leaves me with the Get-Package and Uninstall-Package cmdlet’s. Neither of which work. Here is what I’ve tried:
1:
invoke-command -computername Server1 -scriptblock {(Get-Package -Name "WinMerge*" | Uninstall-package)}
2:
invoke-command -computername Server1 -scriptblock {Uninstall-Package -InputObject (Get-Package -Name 'WinMerge 2.16.38.0' -AllVersions -Force)}
3:
invoke-command -computername Server1 -scriptblock {Get-Package -Name "WinMerge 2.16.38.0" | Uninstall-Package}
4:
invoke-command -computername Server1 -scriptblock {get-package *WinMerge* |% { & $_.Meta.Attributes["UninstallString"]}}
Attempts 1-3 appear to run, but the application remains. Attempt 4 runs but errors with:
The term ‘“C:\Program Files (x86)\WinMerge\unins000.exe”’ is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
+ CategoryInfo : ObjectNotFound: (“C:\Program Fil…e\unins000.exe”:String) , CommandNotFo
undException
+ FullyQualifiedErrorId : CommandNotFoundException
+ PSComputerName : Server1
What am I doing wrong here?