Script to Get Microsoft Product Installed on your machine with version Number

Few days back I was working on build machine. Or you can say I need to release new build machine installed with some specific software.

To achieve this I wrote few bat file to installed particular software silently.

But to verify this whether that software or application has been installed or not I need to check this through control panel. It was kind of manual process.

So avoid this manual process I came across bat file or VBscript file which will list out the entire Microsoft product with version number installed on that particular machine.

First I will show you the bat file to write the entire product with version list in test file:

echo CompanyName SoftwareInstalled VersionNumber>ListOfMicroSoftware.txt

echo ===========================================>>ListOfMicroSoftware.txt
cscript //nologo D:\Install-Jawed\GetListOfSoft.vbs >>ListOfMicroSoftware.txt

Now here is the logic written in VBscript file.
On Error Resume Next

Const strComputer = “.”
Const HKLM = &H80000002
Const strKeyPath = “SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”
Dim oReg, arrSubKeys, strProduct, strDisplayName, strVersion
Set oReg = GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” & _
strComputer & “\root\default:StdRegProv”)
‘ Enumerate the subkeys of the Uninstall key
oReg.EnumKey HKLM, strKeyPath, arrSubKeys
For Each strProduct In arrSubKeys
‘ Get the product’s display name
oReg.GetStringValue HKLM, strKeyPath & “\” & strProduct, “DisplayName”, strDisplayName
‘ Process only products whose name contain ‘Microsoft’
If InStr(1, strDisplayName, “Microsoft”, vbTextCompare) > 0 Then
‘ Get the product’s display version
oReg.GetStringValue HKLM, strKeyPath & “\” & strProduct, “DisplayVersion”, strVersion
WScript.Echo strDisplayName &”======”& vbTab &”===========================================” & strVersion
End If


Click on bat file and it will generate the text file with all products with version number.

Md. jawed

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s