VBS Script To Retrieve BIOS Information For A List Of Machines

 

This VBS script will read a text file called MachineList.Txt and will write BIOS information for each of the machines to an Excel spreadsheet.

 

VBS Script:

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

objExcel.Cells(1, 1).Value = "System Name"

objExcel.Cells(1, 2).Value = "Manufacturer"

objExcel.Cells(1, 3).Value = "Serial Number"

objExcel.Cells(1, 4).Value = "Version"

 

Set Fso = CreateObject("Scripting.FileSystemObject")

Set InputFile = fso.OpenTextFile("MachineList.Txt")

Do While Not (InputFile.atEndOfStream)

strComputer = InputFile.ReadLine

 

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS")

For Each objItem in colItems

objExcel.Cells(intRow, 1).Value = UCase(strComputer)

objExcel.Cells(intRow, 2).Value = objItem.Manufacturer

objExcel.Cells(intRow, 3).Value = objItem.SerialNumber

objExcel.Cells(intRow, 4).Value = objItem.SMBIOSBIOSVersion

intRow = intRow + 1

Next

Loop

 

objExcel.Range("A1:D1").Select

objExcel.Selection.Interior.ColorIndex = 19

objExcel.Selection.Font.ColorIndex = 11

objExcel.Selection.Font.Bold = True

objExcel.Cells.EntireColumn.AutoFit

 

Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

Set objRange = objExcel.Range("A1")

objRange.Sort objRange,1,,,,,,1

 

MsgBox "Done"

 

 

 

Published Monday, December 22, 2008 9:39 AM by dhite
Filed under:

Comments

No Comments