I wanted a simple utility to create a list of all programs listed in Add/Remove Programs on my laptop. I searched on net for the utility and got a vbscript code for the same. However I tweaked it to my personal taste. Here is the code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Product",,48)
For Each objItem in colItems
Write this code in a text editor and save the file with the extension .vbs. Open command prompt, navigate to the directory where you saved the .vbs file. Type following command :
cscript temp.vbs > temp2.txt
Open temp2.txt and you will see the list of programs as follows:
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
Windows Media Player Firefox Plugin
Microsoft Visual Studio 2010 Service Pack 1
Adobe Common File Installer
By default, cscript command displays a logo when the script runs under CScript. The logo, which appears prior to any of the output from the script, looks like this:Microsoft (R) Windows Script Host Version 5.6Copyright (C) Microsoft Corporation 1996-2000. All rights reserved.
You can get rid of the logo using //nologo option as follows:
cscript //nologo temp.vbs > temp2.txt
This utility lists the programs that were installed using Windows Installer. That was my requirement. You can tweak it to lists programs installed using other installers too.
More about the
Win32_Product WMI class is given on MSDN.