- Get-Package "Google Chrome" | % { & ($_.Meta.Attributes["UninstallString"] -replace '"') /S
This command uninstalls other software except Google chrome , provider is programs. I have tried many things but this does not work. Please help
This command uninstalls other software except Google chrome , provider is programs. I have tried many things but this does not work. Please help
You say that your Google Chrome installation was performed via the
Programspackage-management provider, rather than via themsiprovider (for the latter, see the bottom section).Assuming that
$_.Meta.Attributes["UninstallString"]has a value, it contains a string that contains a no-shell / for-cmd.execommand line, which often will not work when executed directly from PowerShell withInvoke-Expression, because PowerShell has more metacharacters thancmd.exethat require quoting, notably{and}, as used in GUIDs.&, the call operator does not support executing whole command lines, it expects only the name or path of a command or executable, optionally followed by arguments.In the simplest case, you can do the following:
For more information, see this answer.
IF your Google Chrome was installed via the
msipackage provider (verify with:(Get-Package 'Google Chrome').ProviderName):Not all installed programs have an
UninstallStringattribute (and even fewer have aQuietUninstallStringone), and anmsi-provider-installed Google Chrome doesn't have one.However, you should be able to pipe to
Uninstall-Packagefor silent (unattended) uninstallation: