ToolsThe other day I was working with a customer who had discovered several ‘unauthorized’ installs of a particular software package. Apparently the install files, and the serial number needed to activate the software, were stored together on a network share to which everyone had READ permissions, and once word got out, lots of users decided they wanted to run that software on their computer.

Since the company had only purchased licenses for the department that actually needed the software, they needed to either buy a lot more licenses, or get the software off the machines where it didn’t belong, and in either case, better secure that share.

There are several reasons you may need to uninstall software from remote machines. You may need to remove it because your users went a little bit over the line as in the example above, or perhaps you don’t want to renew your licensing for software that is no longer required, or perhaps there may be a security flaw and the best way to address that is to uninstall the software.

If you need to remove software from a remote machine you can do so using a combination of PSEXEC and MSIEXEC.

PSEXEC is one of the command line tools originally made available by the geniuses at SysInternals. While Microsoft did purchase their company, the SysInternals tools remain free to use and are continually updated by their creators.

MSIEXEC is a standard part of modern Windows operating systems and is used whenever software is installed using an MSI file.

Prerequisites

To uninstall software using the method below, the software needs to have been installed using an MSI file. Since this is a standard deployment method for most commercial packages, this should not be too problematic. Of course, to do this, you also must have administrative rights to the remote machine.

Before you begin

Download PSEXEC from Microsoft at http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx. Install it onto your computer by copying the file to a directory in your PATH. System32 will do nicely, or you can create a new directory to store your favorite command line tools and add it to your path.

Uninstall the software

  1. Open an administrative command prompt on your machine where you have copied PSEXEC.
  2. Run the following command.
    psexec \\remotecomputername  msiexec /x /q pathtotheMSIfile

The UNC path to the remote computer can use either the NetBIOS name or the FQDN. The path to the MSI file must be relative to the machine you are uninstalling the software from. Again, a UNC path works well here. The /x means to uninstall, and /q means to do so without user input (quietly.)

Pro tip: If you use psexec \\* it will run against every computer in the domain!

Run this against all the offending machines and you will soon have whatever issue concerned you well in hand.