code_junkie

Why is enumerating installed MSI packages so slow?

Nov 11th, 2011
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. strComputer = "."
  2.  
  3. Set objWMIService = GetObject("winmgmts:" & _
  4. "{impersonationLevel=impersonate}!\" & _
  5. strComputer & _
  6. "rootcimv2")
  7.  
  8. Set colSoftware = objWMIService.ExecQuery _
  9. ("SELECT * FROM Win32_Product")
  10.  
  11. If colSoftware.Count > 0 Then
  12. For Each objSoftware in colSoftware
  13. WScript.Echo objSoftware.Caption & vbtab & _
  14. objSoftware.Version
  15. Next
  16. Else
  17. WScript.Echo "Cannot retrieve software from this computer."
  18. End If
Add Comment
Please, Sign In to add comment