list of software installed in a machine
The list of software installed in a machine is easier to find if you have a single system. In case of several servers for any project / application, i needs a automatic tool to generate the report. It can be embedded into your daily dashboard or monthly health check reports.
We can achieve this through two ways. One through VB script and another through PsTools executable.
Vb Script for finding installed software in the machine. We can edit the contents to make the output in required format for the consumption.
- Option Explicit
- Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
- Dim strComputer, strKey, CurrentDirectory, Filepath
- strComputer = "."
- strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
- 'Get script current folder
- CurrentDirectory = left(WScript.ScriptFullName,(Len(WScript.ScriptFullName))-(len(WScript.ScriptName)))
- 'set result file path
- Filepath = CurrentDirectory & "\InstalledSoftware.txt"
- Dim FSO, TextFile, objReg, strSubkey, arrSubkeys
- 'create filesystem object
- Set FSO = CreateObject("scripting.FileSystemObject")
- 'Create new text file
- Set TextFile = FSO.CreateTextFile(Filepath)
- 'Get WMI object
- Set objReg = GetObject("winmgmts://" & strComputer & "/root/default:StdRegProv")
- objReg.EnumKey HKLM, strKey, arrSubkeys
- Textfile.WriteLine "Installed Applications: "
- Textfile.WriteLine
- 'Loop registry key.
- Dim DisplayName,DisplayVersion, InstallDate, EstimatedSize, UninstallString
- For Each strSubkey In arrSubkeys
- objReg.GetStringValue HKLM, strKey & strSubkey, "DisplayName" , DisplayName
- If DisplayName <> "" Then
- Textfile.WriteLine "Display Name : " & DisplayName
- objReg.GetStringValue HKLM, strKey & strSubkey, "DisplayVersion" , DisplayVersion
- Textfile.WriteLine "Version : " & DisplayVersion
- objReg.GetStringValue HKLM, strKey & strSubkey, "InstallDate", InstallDate
- Textfile.WriteLine "InstallDate : " & InstallDate
- objReg.GetDWORDValue HKLM, strKey & strSubkey, "EstimatedSize" , EstimatedSize
- If EstimatedSize <> "" Then
- Textfile.WriteLine "Estimated Size: " & Round(EstimatedSize/1024, 3) & " megabytes"
- Else
- Textfile.WriteLine "Estimated Size: "
- End If
- objReg.GetStringValue HKLM, strKey & strSubkey, "UninstallString", UninstallString
- Textfile.WriteLine "Uninstall :" & UninstallString
- Textfile.Writeline
- End If
- Next
- TextFile.Close
- WScript.Echo "Generate 'InstalledSoftware.txt' successfully."
Apart from VBScript, we can use psinfo.exe to get the list. It is available as an exe from microsoft website to use.
Ex: psinfo -s --> Lists the software installed in the local machine..
Comments
Post a Comment