The (Awesome) Universal Uninstall Script


So, it is the final quarter of the year, internal audit has just woken up from their hibernation directly up your…sleeves, and wants to keep stuff compliant.

Your manager, for the little sadist that he is, sends you a list of some twenty+ applications to uninstall from all the end-user machines.

As you already experienced the pain of uninstalling different applications from different vendors before, you know that not every company builds a way to perform silent/command line uninstallation.

So you tell your manager: Not this time you neo-fascist! (In your mind, of course, you don’t want to end up on the streets working for Facebook, because #DeleteFacebook right? Too much? ok…)

Today we will use a commercial uninstall tool coupled with our custom script to uninstall virtually any software, remotely and silently.

First, you need to buy Revo Uninstaller Pro Portable, it costs around 30$ per year, cheaper than a mid-fancy dinner.
Then, you create a deployment package, save my following script in the same directory as RevoUnPro.exe and publish it to all your users:

$sleeptime = Get-Random -Minimum 0 -Maximum 600
sleep $sleeptime

for($i=0;$i -lt 3;$i++){

	get-process RevoUnPro* | stop-process

	$installedProducts = get-wmiobject -namespace 'root\cimv2\sms' -class sms_installedSoftware
	$productNames="Adobe Photoshop 7.0","Adobe Photoshop CC","Adobe Photoshop CC 2014","Adobe Photoshop CC 2015.5","Adobe Photoshop CC 2017","Adobe Photoshop CC 2017","Adobe Photoshop CC 2017","Adobe Photoshop CC 2017","Adobe Photoshop CC 2017","Adobe Photoshop CC 2018","Adobe Photoshop CC 2018","Adobe Photoshop CC 2018","Adobe Photoshop CC 2018","Adobe Photoshop CS","Adobe Photoshop CS3","Adobe Photoshop CS3","Adobe Photoshop CS4","Adobe Photoshop CS4 (64 Bit)","Adobe Photoshop CS4 Support","Adobe Photoshop CS5","Adobe Photoshop CS5","Adobe Photoshop CS5.1","Adobe Photoshop CS6"

	foreach ($product in $productNames){

		$checkproduct = $installedProducts | where { ($_.ARPdisplayname -like $product) }


		if($productname.length -gt 0){
			$loca = [string]$checkproduct.InstalledLocation

			if ($loca[$loca.length-1] -eq "\"){
				$loca = $loca.substring(0,$loca.length-1)


			cmd /c start cmd /c RevoUnPro.exe /mu "$product" /path "$loca" /mode Advanced /32 ; cmd /c start cmd /c RevoUnPro.exe /mu "$product" /path "$loca" /mode Advanced /64



	if(-not $foundonce){
		$sleeptime = Get-Random -Minimum 600 -Maximum 1200
		sleep $sleeptime
	write-host "looped"

As you can already see, the script is a mess, but it gets the job done.

It performs 3 rounds of cleaning, to make sure no locked residues are left.
You can try to tweak the number of rounds depending on your application, but I found that 3 is the optimal number.

This example uninstalls several different Photoshop versions, defined in $productNames . Of course, feel free to parametrize this variable for more flexible deployments.

A note though: PLEASE do not uninstall Microsoft Office individual products with this script, as it will have unpredictable results, use the official tools provided by Microsoft.

I’m sure that there are much cleaner ways to do it, so if you know any, please, let me know in the comments!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s