Thanks to Avast’s free for education Endpoint Protection, I was able to centrally manage and deploy Avast around the organization for a client. The problem was that once I had Avast on there, I also needed to be able to uninstall the previous security software, Panda Cloud Antivirus. Since it didn’t have a nice central console, it would entail running around to each computer and uninstalling it manually. After a brief search online, it appeared I was on my own for uninstalling the software.
Completing the task manually was nothing terribly complicated. It was just a matter of opening the Control Panel, going to Add/Remove Programs, scrolling down to find Panda Cloud Antivirus, and hitting the button to uninstall. The process of getting there was a little time consuming but the uninstaller took even longer. Fortunately, I was recently tasked with a similar need and had an idea of how I might script Panda’s uninstall after all.
The solution goes back to using our old pal WMI. Using the command line implementation of WMI, WMIC we can make a call to the Product class to find most applications that have been installed and registered with Windows. From there, instead of just getting information back from the computer, we can actually make a call to the product uninstaller.
<code>wmic product where "Name like 'Panda Cloud Antivirus'" call uninstall /nointeractive</code>
You can use the command to get the name and version of all products so you know what to put in your script.
wmic product get name, version
You can then select a product name provided and use it with the first script. You can also build upon it by using wildcards if, for example, the version number was included in the product name and you wanted to uninstall all versions of the product.
wmic product where “Name like ‘Adobe Reader%%'” call uninstall
The script has to be run as an administrator. I wrapped the Panda Cloud Antivirus uninstaller in a batch file and assigned it as a shutdown script through Group Policy and the process has worked out well. You can also add some logic to the script so it only runs once to make it a bit nicer from the end user perspective.