Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for lstoffvw.vbs

(view source code of lstoffvw.vbs as plain text)

  1. Option Explicit
  2.  
  3. If WScript.Arguments.Count > 0 Then Syntax
  4.  
  5. Dim colItems, objItem, objWMIService, strComputer, strName
  6.  
  7. strComputer = "."
  8.  
  9. Set objWMIService = GetObject( "winmgmts://" & strComputer & "/root/CIMV2" )
  10. Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Product", "WQL", 48 )
  11. For Each objItem In colItems
  12. 	strName = LCase( objItem.Name )
  13. 	If InStr( strName, "microsoft office" ) Then
  14. 		If InStr( strName, "viewer" ) Then
  15. 			WScript.Echo Left( objItem.Name & Space( 56 ), 56 ) & Right( Space( 20 ) & objItem.Version, 20 )
  16. 		End If
  17. 	End If
  18. Next
  19.  
  20.  
  21. Sub Syntax( )
  22. 	Dim strMsg
  23. 	strMsg = vbCrLf _
  24. 	       & "LstOffVw.vbs,  Version 1.00" _
  25. 	       & vbCrLf _
  26. 	       & "List all Office Viewers installed on the local computer" _
  27. 	       & vbCrLf & vbCrLf _
  28. 	       & "Usage:  CSCRIPT.EXE //NoLogo LSTOFFVW.VBS" _
  29. 	       & vbCrLf & vbCrLf _
  30. 	       & "Note:   This (WMI) query may take a couple of minutes to complete" _
  31. 	       & vbCrLf & vbCrLf _
  32. 	       & "Written by Rob van der Woude" _
  33. 	       & vbCrLf _
  34. 	       & "http://www.robvanderwoude.com"
  35. 	WScript.Echo strMsg
  36. 	WScript.Quit 1
  37. End Sub
  38.  

page last modified: 2024-04-16; loaded in 0.0092 seconds