About us

IIS covers the IT solutions to the issues come across now and then in a company IT infrastructure including Operating system, Softwares, Scriptings, securities and reviews.

Tuesday, 25 February 2014

Full computer details in a excel

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
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
Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory",,48)
For Each objItem in colItems

    Excel.cells(r, 12).value = objItem.Capacity
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)
Excel.cells(r, 1).value = wshNetwork.UserDomain
Excel.cells(r, 2).value = wshNetwork.UserName


No comments:

Post a Comment