'========================================================================== ' ' DESC: Inventories computer configuration and writes report to disk ' ' AUTHOR: Todd Woolums (twoolums@toddwoolums.com) ' DATE : 05/29/2004 ' VERSION: 1.0 '========================================================================== on error resume Next Set oShell = CreateObject("wscript.Shell") Set env = oShell.environment("Process") strComputer = env.Item("Computername") Const HKEY_LOCAL_MACHINE = &H80000002 Const UnInstPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ ".\root\default:StdRegProv") report = strComputer & " Computer Inventory" & vbCrLf & "******************************************" & vbCrLf & vbCrLf Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48) report = report & vbCrLf & "******************************************" & vbCrLf report = report & "OS Information" & vbCrLf & "******************************************" & vbCrLf & vbCrLf For Each objItem in colItems report = report & strComputer & vbCrLf & "OS Details"& vbCrlf report = report & "Caption: " & objItem.Caption & vbCrLf report = report & "Description: " & objItem.Description & vbCrLf report = report & "EncryptionLevel: " & objItem.EncryptionLevel & vbCrLf report = report & "InstallDate: " & objItem.InstallDate & vbCrLf report = report & "Manufacturer: " & objItem.Manufacturer & vbCrLf report = report & "MaxNumberOfProcesses: " & objItem.MaxNumberOfProcesses & vbCrLf report = report & "Name: " & objItem.Name & vbCrLf report = report & "Organization: " & objItem.Organization & vbCrLf report = report & "OSProductSuite: " & objItem.OSProductSuite & vbCrLf report = report & "RegisteredUser: " & objItem.RegisteredUser & vbCrLf report = report & "SerialNumber: " & objItem.SerialNumber & vbCrLf report = report & "ServicePackMajorVersion: " & objItem.ServicePackMajorVersion & vbCrLf report = report & "ServicePackMinorVersion: " & objItem.ServicePackMinorVersion & vbCrLf report = report & "Version: " & objItem.Version & vbCrLf report = report & "WindowsDirectory: " & objItem.WindowsDirectory & vbCrLf Next Set colSettings = objWMIService.ExecQuery _ ("Select * from Win32_ComputerSystem") report = report & vbCrLf & "******************************************" & vbCrLf report = report & "Memory and Processor Information" & vbCrLf & "******************************************" & vbCrLf & vbCrLf For Each objComputer in colSettings 'report = report & objComputer.Name & vbcrlf report = report & objComputer.TotalPhysicalMemory /1024\1024+1 & "MB Total memory" & vbcrlf Next Set colSettings = objWMIService.ExecQuery _ ("Select * from Win32_Processor") For Each objProcessor in colSettings report = report & objProcessor.Description & " Processor" & vbCrLf Next report = report & vbCrLf & "******************************************" & vbCrLf report = report & "Disk Drive Information" & vbCrLf & "******************************************" & vbCrLf & vbCrLf Set objWMIService = GetObject("winmgmts:") Set objLogicalDisk = objWMIService.Get("Win32_LogicalDisk.DeviceID='c:'") report = report & objLogicalDisk.FreeSpace /1024\1024+1 & "MB Free Disk Space" & vbCrLf report = report & objLogicalDisk.Size /1024\1024+1 & "MB Total Disk Space" & vbCrLf oReg.EnumKey HKEY_LOCAL_MACHINE, UnInstPath, arrSubKeys software = vbCrLf & "******************************************" & vbCrLf software = software & vbCrLf & "Installed Software" & vbCrLf & "******************************************" & vbCrLf & vbCrLf For Each subkey In arrSubKeys 'MsgBox subkey If Left (subkey, 1) <> "{" Then software = software & subkey & vbCrLf End If Next Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.CreateTextFile (strComputer & ".txt", ForWriting) ts.write report ts.write software 'MsgBox Report MsgBox "Done"