Jump to content

[Powershell] Uninstall all other versions of a specific application


Recommended Posts

Posted

Hello,

I have a PS script that I'd like to run to remove all previous versions of Policy Central except for any that match the current version number. Here's what I have so far:

Foreach-Object {
   Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, UninstallString | Where-Object DisplayName -Like "*Policy Central*"
   Format-Table –AutoSize}

That code presents me with all items named like 'Policy Central' from the Uninstall key from the registry and also displays the version number, we well as the 'Uninstall String'.

 

How can I utilize that uninstall string for each version of Policy Central that does not match a specific version number?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...