-1

I have a user who needs iCloud uninstalled. The problem is I have heard her through the walls coughing like a sick llama for two weeks now (“HAROUUUUUU”) and I don’t want to get what she’s giving.

How do I uninstall the program remotely?

Windows 7 on both ends, AD, I have enough domain permissions to view installed programs on her computer with

wmic /output:c:\userName.txt /user:MYUSERNAMEHERE /node:"THEIRCOMPUTERNAME" product get name

(don't neglect the quotes around their computer name) and I can also browse her C$ drive.

EDIT: I posted both the question & answer in order to spread knowledge. Though this example was when I learned how to uninstall remotely even though it was a one-off deal, perhaps a better case for using the solution below is when you need to do a quiet uninstall, which I happened to do for this user to avoid interrupting the user's workflow, or for a mass uninstall over the network.

1 Answers1

0

This is a compilation answer of two very knowledgeable sources:

Step 1, from Where does Windows store MSI files for uninstallation? find the MSI that the program was (usually) installed with (skip to “2)” for the easier way to do it):

When a user installs some app, Windows does the following:

1) Creates a registry key for this app.

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall[ProductId GUID]

If you have access to the original msi file of installer of your app, you can find [ProductID GUID] by opening the msi file in orca.exe and clicking on the "Property" on the left in orca, and looking for "ProductCode" line on the right. If you do not have access to original *.msi file, you can just search registry key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall for the name of the app.

If you want to delete your app (which refuses to uninstall for example) from the list of installed apps in Control Panel, you can delete the entry from this Uninstall key. It will surely disappear from the list in control panel, but Windows will still remember it. For example, if you try to install a next version of the same app, Installer may still insist on uninstalling the previous version. See item 2 for that.

2) Windows copies the original *.msi file into the folder C:\Windows\Installer and renames it to a random name (keeps .msi extension though). Windows also creates a key in registry in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData[InternalUserId]\Products[some random guid-like sequence of chars identifying to windows your installation]\InstallProperties. ValueName "LocalPackage" in this reg key will point to the renamed msi file. To find the file in C:\windows\Installer you can navigate to this folder in Windows explorer, switch it into Details view, make column "Subject" visible and you will see for all nnnnnnnn.msi fies their corresponding name of product. – note, after adding “Subject” change the sort by order to refresh the listing

3) This was necessary for @Joe B from the link above: I had to copy the 5188bfc6.msi file ( hex#.msi ) and rename it to the original file name MyApp.msi, before uninstaller would accept the file. After this uninstall worked fine.

Step 2, install PsExec (from MS) - these instructions taken from https://techtalk.gfi.com/how-to-uninstall-software-from-remote-pcs-using-the-command-line/ :

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.

Step 3, uninstall the program:

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!

You can use that WMIC command again to make sure it’s gone afterward

wmic /output:c:\userName.txt /user:MYUSERNAMEHERE /node:"THEIRCOMPUTERNAME" product get name