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.

  1. Option Explicit   
  2. Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE   
  3. Dim strComputer, strKey, CurrentDirectory, Filepath  
  4. strComputer = "."   
  5. strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"   
  6. 'Get script current folder  
  7. CurrentDirectory = left(WScript.ScriptFullName,(Len(WScript.ScriptFullName))-(len(WScript.ScriptName)))  
  8. 'set result file path   
  9. Filepath = CurrentDirectory & "\InstalledSoftware.txt"  
  10. Dim FSO, TextFile, objReg, strSubkey, arrSubkeys   
  11. 'create filesystem object   
  12. Set FSO = CreateObject("scripting.FileSystemObject")  
  13. 'Create new text file   
  14. Set TextFile = FSO.CreateTextFile(Filepath)  
  15. 'Get WMI object   
  16. Set objReg = GetObject("winmgmts://" & strComputer & "/root/default:StdRegProv")   
  17. objReg.EnumKey HKLM, strKey, arrSubkeys   
  18. Textfile.WriteLine  "Installed Applications: "   
  19. Textfile.WriteLine  
  20. 'Loop registry key.  
  21. Dim DisplayName,DisplayVersion, InstallDate, EstimatedSize, UninstallString  
  22. For Each strSubkey In arrSubkeys   
  23.   objReg.GetStringValue HKLM, strKey & strSubkey, "DisplayName" , DisplayName  
  24.   If DisplayName <> "" Then   
  25.   Textfile.WriteLine  "Display Name  : " & DisplayName  
  26.   objReg.GetStringValue HKLM, strKey & strSubkey, "DisplayVersion" , DisplayVersion  
  27.   Textfile.WriteLine  "Version       : " & DisplayVersion  
  28.   objReg.GetStringValue HKLM, strKey & strSubkey, "InstallDate", InstallDate  
  29.   Textfile.WriteLine  "InstallDate   : " & InstallDate   
  30.   objReg.GetDWORDValue HKLM, strKey & strSubkey, "EstimatedSize" , EstimatedSize  
  31.   If  EstimatedSize <> "" Then   
  32.   Textfile.WriteLine  "Estimated Size: " & Round(EstimatedSize/10243) & " megabytes"   
  33.   Else   
  34.   Textfile.WriteLine  "Estimated Size: "   
  35.   End If   
  36.   objReg.GetStringValue HKLM, strKey & strSubkey, "UninstallString", UninstallString  
  37.   Textfile.WriteLine  "Uninstall     :" & UninstallString  
  38.   Textfile.Writeline  
  39.   End If   
  40. Next   
  41.   
  42.   
  43. TextFile.Close   
  44. 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

Popular posts from this blog

Base 64 encoding and decoding

LINQ Queries with GROUP BY, INNER JOIN, COUNT and SUM: Examples

How to write Custom delete Confirmation Modal for Kendo Grid in MVC: