I’ve come up with a handy multi-function tool to detect and uninstall software silently with PCSM. The script relies on the program being originally installed from an MSI or an MSI wrapped in an executable. So not all software will work but a good amount do so it’s worth a try. The script can be run in two modes:
Running the executable on its own with no parameters will return a list of all software detected in the registry that can be uninstalled silently with MSIEXEC. The relevant software and commands are output to the StdOut. The following command will achieve this:
1 @ECHO OFF
3 PUSHD %~dp0
Running the executable with parameters passed will try to uninstall any software that matches the search strings that are passed. You can pass multiple search string to the executable to try to uninstall more than one type of software.
This may be a good to combine with an installation script to uninstall any previous version of the software before adding the new one. Just make sure that you don’t have a piece of software that relies on an earlier version of the software to run correctly (Java is a prime example of this where some programs that rely on it will only run up to a certain version but not always with the latest)
BE CAREFUL WHAT YOU PASS!!!
Passing “Adobe” will attempt to uninstall ALL software that contains the string “Adobe”
Passing “Adobe Reader” will attempt to uninstall ALL software that contains the string “Adobe Reader”
Passing “Adobe Reader 9.3.3″ will attempt to uninstall ALL software that contains the string “Adobe Reader 9.3.3″
You get the idea!
The following code would try to uninstall any version of Java 5 and 6
1 @ECHO OFF
3 PUSHD %~dp0
5 SilentUninstall.exe "J2SE Runtime Environment 5.0 Update" "Java(TM) 6 Update"
You can pass as many search strings as you want in this way. It’s worth running the script using method 1 to see the way that the script identifies software packages.
The script tags the version on to the end of the results in the software list to allow you to be more specific if you require.
The results string for Java for example is actually “Java(TM) 6 Update 21 6.0.210″ which is the software name and version combined. If you only want to uninstall this version then pass “Java(TM) 6 Update 21 6.0.210″ to the script to get the results that you desire.
I have run tests on a many devices now and it seems to work pretty well. Please ensure that you test this before sending it out to hundreds of devices!
If you’re in any doubt, use method 1 to get the commands and run the uninstallations singly.
Also don’t expect it to work on everything that is returned as some software looks like it would uninstall fine but actually may have links to other software which are preventing the uninstallation. A prime example of this is SQL Express as some of the installed components can be uninstalled with this script but others can’t. This is because they are locked to the main SQL Express installation which doesn’t support silent uninstallation using the standard MSI method in this script.
I’ve tried to give a nice verbose output too so at least you can see what has passed/failed the attempted uninstallation. Probably best to test the applications you wish to uninstall on a test rig first.
The script executable can be downloaded from here:
- See more at:
http://www.scriptingsimon.com/wp-conten ... nstall.exe