This script is very important for someone in IT infra and provide all information in one excel file which he ever dreamed of. This collects hostname, manufacturer, bios version, release date, serial number, user domain and logged in user name.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colBIOS = objWMIService.ExecQuery _
("Select * from Win32_BIOS")
Set wshNetwork = WScript.CreateObject( "WScript.Network" )
Set Excel = WScript.CreateObject("Excel.Application")
Set ExWb = Excel.Workbooks.Open("C:\test.xls",,False)
Set ExWs = ExWb.Worksheets(1)
r = 1
Do Until len(Excel.Cells(r, 1).value) = 0
r = r + 1
Loop
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For Each objItem in colItems
Excel.cells(r, 6).value = objItem.Model
Excel.cells(r, 13).value = Now
Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory",,48)
For Each objItem in colItems
Excel.cells(r, 12).value = objItem.Capacity
Next
For each objBIOS in colBIOS
Excel.cells(r, 5).value = objBIOS.InstallableLanguages
Excel.cells(r, 4).value = objBIOS.Manufacturer
Excel.cells(r, 7).value = objBIOS.Name
Excel.cells(r, 8).value = objBIOS.PrimaryBIOS
Excel.cells(r, 9).value = objBIOS.ReleaseDate
Excel.cells(r, 3).value = objBIOS.SerialNumber
Excel.cells(r, 11).value = objBIOS.SMBIOSBIOSVersion
For i = 0 to Ubound(objBIOS.BiosCharacteristics)
Excel.cells(r, 17).value = objBIOS.BiosCharacteristics(i)
Next
Next
Excel.cells(r, 1).value = wshNetwork.UserDomain
Excel.cells(r, 2).value = wshNetwork.UserName
ExWb.Save
Excel.Application.Quit
Regards,
Baij
No comments:
Post a Comment