Rob van der Woude's Scripting Pages

VBScript Scripting Techniques > Inventory > Generate MSInfo Reports

Generate MSInfo Reports

 

Msinfo32.MSInfo.1
VBScript Code:
Option Explicit

' Create a full MSInfo report of the local
' computer, and save it as C:\msinforeport.txt
MSInfo ".", "C:\msinforeport.txt", True


Sub MSInfo( myComputer, myReportFile, blnFullReport )
' This subroutine generates an MSInfo report for the specified
' computer, saving it under the specified file name.
'
' Arguments:
' myComputer     [string]   the computer to be queried, or a dot
'                           or empty string for the local computer
' myReportFile   [string]   the file name of the report to be generated
' blnFullReport  [boolean]  if True, a full report will be generated,
'                           otherwise only an OS summary is generated
'
' Returns:
' A full MSInfo report file for the specified computer
'
' Written by Rob van der Woude
' http://www.robvanderwoude.com

    Dim objMSInfo, strCategory, varPctDone, wshShell

    If myComputer = "" Or myComputer = "." Then
        ' Get the computer name of the local computer
        Set wshShell = CreateObject( "WScript.Shell" )
        myComputer   = wshShell.ExpandEnvironmentStrings( "%ComputerName%" )
        Set wshShell = Nothing
    End If

    If blnFullReport = True Then
        strCategory = ""
    Else
        strCategory = 0
    End If

    ' Query the computer and generate the report
    Set objMSInfo = CreateObject( "Msinfo32.MSInfo.1" )
    objMSInfo.UpdateDCOProgress( varPctDone )
    objMSInfo.SaveFile myReportFile, myComputer, strCategory
    Set objMSInfo = Nothing
End Sub
Requirements:
Windows version: not sure, tested in Windows XP SP2
Network: any
Client software: N/A
Script Engine: any
Summarized: Should work in Windows 2000 or later.
Uncertain if it will work in Windows 95, 98, ME or NT 4.
 
[Back to the top of this page]

page last modified: 2016-09-19; loaded in 0.0019 seconds