Just to preface, My user’s do not have the ability to install any software on their PC’s, therefore they cannot update each individual software package, such as JAVA Runtime, Adobe Flashplayer, Adobe Reader, etc… these are about standard to have installed on each computer that accesses the internet, or receive emails. Like usual, these are security vulnerabilities if they are not kept up-to-date.
Also, it should be noted that I despise when software does not ship with a standard MSI. There is absolutely no way that I will go to every computer to install things like Adobe Reader, which is updated every quarter, and Adobe refuses to simply post an MSI for each update of Reader, and instead ships a patch for each release, so the SysAdmin has to build their own MSI, from Major release, to patch 1, to patch 2, to patch3, etc… Furthermore, Java, is only available as an EXE, which extracts an MSI to the current user’s APPDATA folder. from there, one is supposed to use ORCA to build a custom MSI using the options desired. It is so annoying, if i want to use Group Policy to manage these updates. Granted the Java EXE has silent install options, it DOES NOT uninstall the previous versions, and each one takes up to 100MB of disk space.
I needed a way to uninstall all versions of Java, remotely, and silently, so i can “secure” my end user’s PCs with latest releases. This is when I came across some awesomeness using wildcards with the wmic command, as running with Domain Admin credentials.
The following will list all installed versions of Java on a local computer:
wmic product where “name like ‘Java%'” get name
The following will uninstall all versions of java on a local computer:
wmic product where “name like ‘Java%'” call uninstall
The following will uninstall all versions of java on a remote computer:
wmic /node:[computername] product where “name like ‘Java%'” call uninstall
therefore… if you have a list of computers stored in a text file… you can uninstall anything you want across a domain in one command:
for /f %n in (all-domain-pcs.txt) do wmic /node:%n product where “name like ‘Java%'” call uninstall
This is not fast at all, but effective. It definitely beats working on each pc one at a time, uninstalling each java update, one at a time.
The power of this tool is awesome, especially when planning for upgrades, when you want to uninstall every office installation
Disclaimer: Use this at your own risk. i will not be held responsible if you manage to uninstall everything from your domain computers.