VBS Script To Return The Processor Architecture Platform Information From A List Of Machines

 

The VBS Script here will read a list of machines in a text file called MachineList and will provide you with the processor platform information for each resource.

 

VBS Script

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

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

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

 

Set Fso = CreateObject("Scripting.FileSystemObject")

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

Do While Not (InputFile.atEndOfStream)

strComputer = InputFile.ReadLine

 

On Error Resume Next

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

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

For Each objItem in colItems

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

If Err.Number <> 0 Then

objExcel.Cells(intRow, 2).Value = Err.Description

Else

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

If objExcel.Cells(intRow, 2).Value = 0 Then

objExcel.Cells(intRow, 2).Value = "x86"

ElseIf objExcel.Cells(intRow, 2).Value = 1 Then

objExcel.Cells(intRow, 2).Value = "MIPS"

ElseIf objExcel.Cells(intRow, 2).Value = 2 Then

objExcel.Cells(intRow, 2).Value = "Alpha"

ElseIf objExcel.Cells(intRow, 2).Value = 3 Then

objExcel.Cells(intRow, 2).Value = "PowerPC"

ElseIf objExcel.Cells(intRow, 2).Value = 6 Then

objExcel.Cells(intRow, 2).Value = "Intel Itanium Processor Family (IPF)"

ElseIf objExcel.Cells(intRow, 2).Value = 9 Then

objExcel.Cells(intRow, 2).Value = "x64"

End If

End If

Next

intRow = intRow + 1

loop

 

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

objExcel.Selection.Interior.ColorIndex = 19

objExcel.Selection.Font.ColorIndex = 11

objExcel.Selection.Font.Bold = True

objExcel.Cells.EntireColumn.AutoFit

 

MsgBox "Done"

 

 

Published Tuesday, December 22, 2009 8:59 AM by dhite
Filed under:

Comments

No Comments