Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for msinfovb.vbs

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

  1. Option Explicit
  2.  
  3. ' Create a full MSInfo report of the local
  4. ' computer, and save it as C:\msinforeport.txt
  5. MSInfo ".", "C:\msinforeport.txt", True
  6.  
  7.  
  8. Sub MSInfo( myComputer, myReportFile, blnFullReport )
  9. ' This subroutine generates an MSInfo report for the specified
  10. ' computer, saving it under the specified file name.
  11. '
  12. ' Arguments:
  13. ' myComputer     [string]   the computer to be queried, or a dot
  14. '                           or empty string for the local computer
  15. ' myReportFile   [string]   the file name of the report to be generated
  16. ' blnFullReport  [boolean]  if True, a full report will be generated,
  17. '                           otherwise only an OS summary is generated
  18. '
  19. ' Returns:
  20. ' A full MSInfo report file for the specified computer
  21. '
  22. ' Written by Rob van der Woude
  23. ' http://www.robvanderwoude.com
  24.  
  25. 	Dim objMSInfo, strCategory, varPctDone, wshShell
  26.  
  27. 	If myComputer = "" Or myComputer = "." Then
  28. 		' Get the computer name of the local computer
  29. 		Set wshShell = CreateObject( "WScript.Shell" )
  30. 		myComputer   = wshShell.ExpandEnvironmentStrings( "%ComputerName%" )
  31. 		Set wshShell = Nothing
  32. 	End If
  33.  
  34. 	If blnFullReport = True Then
  35. 		strCategory = ""
  36. 	Else
  37. 		strCategory = 0
  38. 	End If
  39.  
  40. 	' Query the computer and generate the report
  41. 	Set objMSInfo = CreateObject( "Msinfo32.MSInfo.1" )
  42. 	objMSInfo.UpdateDCOProgress( varPctDone )
  43. 	objMSInfo.SaveFile myReportFile, myComputer, strCategory
  44. 	Set objMSInfo = Nothing
  45. End Sub
  46.  

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