SCCM SQL Query to Build Uninstaller Batch File

I created the follow SQL query to create a batch file that uninstalls all known versions of a piece of software. Feel free to use and tweak as you see fit. You should build the query first to make sure you’re only identifying the GUIDs for software you really want to uninstall. You’ll need to setup SSMS to output as text instead of grid view, then copy and paste into a new batch file and trim the top and bottom a bit to remove the junk that comes with the output.

Here is some sample output:

P.S. Obviously this is only going to work for Windows Installer uninstallations! :-)

Credit to this post on StackOverflow for the NewLineChar line.


Leave a Reply