I want to list the installed softwares on windows server 2008 R2 with a VBscript.
I want to verify prerequisite softwares (one of them is .NET Framework 3.5.1).
I actually have two solutions and they both doesn’t show all the softwares.
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
installedSoftwaresPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
Set objReg = GetObject("winmgmts://./root/default:StdRegProv")
objReg.EnumKey HKLM, installedSoftwaresPath, arrSubkeys
For Each strSubkey In arrSubkeys
Ret = objReg.GetStringValue(HKLM, installedSoftwaresPath & strSubkey, "DisplayName", SoftwareName)
If Ret <> 0 Then
objReg.GetStringValue HKLM, strKey & strSubkey, "QuietDisplayName", SoftwareName
End If
If SoftwareName<> "" Then
WScript.Echo VbCrLf & "Display Name: " & SoftwareName
End If
Next
The other solution is this one :
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colSoftware = objWMIService.ExecQuery("Select * from Win32_Product")
For Each objSoftware in colSoftware
WScript.Echo objSoftware.Caption
Next
Is it possible to get ALL the installed softwares? if not I’m gonna make a specific solution for every prerequisite softwares.
EDIT :
Some software found by my scripts :
Microsoft Application Error Reporting,
Microsoft Visual C++ 2008 Redistributable,
Microsoft Security Client,
Adobe Reader
What I want to found :
.NET framework 3.5.1
I want a generic solution to found every softwares installed.
SOLUTION :
It seems that there is no generic way to check for installed software. I’ve found the .NET framework registry key in this path :
"SOFTWARE\Microsoft\MSBuild\ToolsVersion\v3.5\"
Without having access to your server to see how the software you’re looking for is installed, I can only guess at how you might modify your script.
However, there are other places you should probably be looking besides:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
For example, you may want to look in:
It’s possible that you will find what you are looking for in one of those locations.
You may also want to use RegEdit to do a “Find” for “.NET Framework 3.5.1” to see if that shows up somewhere that you can reliably find it.