'****************************************************
'		Script Witten by Larry Heintz
'		April 2006 www.windowsadminscripts.com
' This script will enumerate cpu properties like CPU
' Type,Manufacture,Speed,Status just to name a few for
' each cpu installed on the computer.
'
' Script Usage: cscript cpu.vbs /computer:[computername]
'****************************************************
Dim args,computername
Set args = Wscript.Arguments.Named
computername = args.Item("computer")

if wscript.arguments.count = 0 then
	wscript.echo "Script Usage: cscript cpu.vbs /computer:[computername]"
elseif args.exists("computer") then
	if computername = "" then
		computername = getComputer()
	else
		computername = computername
	end if
	Call getCPUInfo(computername)
else
	wscript.echo "Script Usage: cscript cpu.vbs /computer:[computername]"
end if

Function getCPUInfo(computer)
On Error Resume Next
Dim objCPU,count
count = 0
wscript.echo "CPU information for " & ucase(computer) & VbCrLF
For each objCPU in GetObject("winmgmts:{impersonationLevel=impersonate}\\" & computer & "\root\cimv2").InstancesOf("Win32_Processor")
if not (errorChecking (computer)) then
	count = count + 1
	wscript.echo "CPU # " & count & " information" & VbCrLF
	wscript.echo "Address Width: " & ObjCPU.AddressWidth & " bit"
	wscript.echo "Architecture: " & ArchitectureResults(ObjCPU.Architecture)
	wscript.echo "Cpu Status: " & CpuStatusResults(ObjCPU.CpuStatus)
	wscript.echo "Current Clock Speed: " & ObjCPU.CurrentClockSpeed & " Mhz"
	wscript.echo "Data Width: " & ObjCPU.DataWidth & " bit"
	wscript.echo "Description: " & ObjCPU.Description
	wscript.echo "Device ID: " & ObjCPU.DeviceID
	wscript.echo "Ext Clock: " & ObjCPU.ExtClock & " Mhz"
	wscript.echo "Family: " & FamilyResults(ObjCPU.Family)
	wscript.echo "L2 Cache Size: " & ObjCPU.L2CacheSize & " KB"
	wscript.echo "L2 Cache Speed: " & ObjCPU.L2CacheSpeed & " Mhz"
	wscript.echo "Last Error Code: " & ObjCPU.LastErrorCode
	wscript.echo "Level: " & ObjCPU.Level
	wscript.echo "Load Percentage: " & ObjCPU.LoadPercentage & "%"
	wscript.echo "Manufacturer: " & ObjCPU.Manufacturer
	wscript.echo "Max Clock Speed: " & ObjCPU.MaxClockSpeed & " Mhz"
	wscript.echo "PNP Device ID: " & ObjCPU.PNPDeviceID
	wscript.echo "Processor Type: " & ProcessorTypeResults(ObjCPU.ProcessorType)
	wscript.echo "Role: " & ObjCPU.Role
	wscript.echo "Socket Designation: " & ObjCPU.SocketDesignation
	wscript.echo "Stepping: " & ObjCPU.Stepping
	wscript.echo "Unique Id: " & ObjCPU.UniqueId
	wscript.echo "Upgrade Method: " & UpgradeMethodResults(ObjCPU.UpgradeMethod)
	wscript.echo "Version: " & ObjCPU.Version
	wscript.echo "Voltage Caps: " & VoltageCapsResults(ObjCPU.UpgradeMethod)
	wscript.echo "==========================================="
end if
Next
End Function

Function VoltageCapsResults(result)
Select Case result
	Case 1
		VoltageCapsResults = "5 Volts"
	Case 2
		VoltageCapsResults = "3.3 Volts"
	Case 4
		VoltageCapsResults = "2.9 Volts"
End Select
End Function

Function UpgradeMethodResults(result)
Select Case result
	Case 1
		UpgradeMethodResults = "Other"
	Case 2
		UpgradeMethodResults = "Unknown"
	Case 3
		UpgradeMethodResults = "UpgradeMethod"
	Case 4
		UpgradeMethodResults = "ZIF Socket"
	Case 5
		UpgradeMethodResults = "ZIF Socket"
	Case 6
		UpgradeMethodResults = "None"
	Case 7
		UpgradeMethodResults = "LIF Socket"
	Case 8
		UpgradeMethodResults = "Slot 1"
	Case 9
		UpgradeMethodResults = "Slot 2"
	Case 10
		UpgradeMethodResults = "370 Pin Socket"
	Case 11
		UpgradeMethodResults = "Slot A"
	Case 12
		UpgradeMethodResults = "Slot M"
	Case 13
		UpgradeMethodResults = "Socket 423"
	Case 14
		UpgradeMethodResults = "Socket A (Socket 462)"
	Case 15
		UpgradeMethodResults = "Socket 478"
	Case 16
		UpgradeMethodResults = "Socket 754"
	Case 17
		UpgradeMethodResults = "Socket 940"
	Case 18
		UpgradeMethodResults = "Socket 939"
End Select
End Function

Function ProcessorTypeResults(result)
Select Case result
	Case 1
		ProcessorTypeResults = "Other"
	Case 2
		ProcessorTypeResults = "Unknown"
	Case 3
		ProcessorTypeResults = "Central Processor"
	Case 4
		ProcessorTypeResults = "Math Processor"
	Case 5
		ProcessorTypeResults = "DSP Processor"
	Case 6
		ProcessorTypeResults = "Video Processor"
End Select
End Function

Function CpuStatusResults(result)
Select Case result
	Case 0
		CpuStatusResults = "Unknown"
	Case 1
		CpuStatusResults = "CPU Enabled"
	Case 2
		CpuStatusResults = "CPU Disabled by User via BIOS Setup"
	Case 3
		CpuStatusResults = "CPU Disabled By BIOS (POST Error)"
	Case 4
		CpuStatusResults = "CPU is Idle"
	Case 5
		CpuStatusResults = "Reserved"
	Case 6
		CpuStatusResults = "Reserved"
	Case 7
		CpuStatusResults = "Other"
End Select
End Function

Function ArchitectureResults(result)
Select Case result
	Case 0
		ArchitectureResults = "x86"
	Case 1
		ArchitectureResults = "MIPS"
	Case 2
		ArchitectureResults = "Alpha"
	Case 3
		ArchitectureResults = "PowerPC"
	Case 6
		ArchitectureResults = "Intel Itanium Processor Family (IPF)"
	Case 9
		ArchitectureResults = "x64"
End Select
End Function

Function FamilyResults(result)
Select Case result
	Case 1
		FamilyResults = "Other"
	Case 2
		FamilyResults = "Unknown"
	Case 3
		FamilyResults = "8086"
	Case 4
		FamilyResults = "80286"
	Case 5
		FamilyResults = "80386"
	Case 6
		FamilyResults = "80486"
	Case 7
		FamilyResults = "8087"
	Case 8
		FamilyResults = "80287"
	Case 9
		FamilyResults = "80387"
	Case 10
		FamilyResults = "80487"
	Case 11
		FamilyResults = "Pentium brand"
	Case 12
		FamilyResults = "Pentium Pro"
	Case 13
		FamilyResults = "Pentium II"
	Case 14
		FamilyResults = "Pentium processor with MMX technology"
	Case 15
		FamilyResults = "Celeron"
	Case 16
		FamilyResults = "Pentium II Xeon"
	Case 17
		FamilyResults = "Pentium III"
	Case 18
		FamilyResults = "M1 Family"
	Case 19
		FamilyResults = "M2 Family"
	Case 24
		FamilyResults = "K5 Family"
	Case 25
		FamilyResults = "K6 Family"
	Case 26
		FamilyResults = "K6-2"
	Case 27
		FamilyResults = "K6-3"
	Case 28
		FamilyResults = "AMD Athlon Processor Family"
	Case 29
		FamilyResults = "AMD® Duron Processor"
	Case 30
		FamilyResults = "AMD29000 Family"
	Case 31
		FamilyResults = "K6-2+"
	Case 32
		FamilyResults = "Power PC Family"
	Case 33
		FamilyResults = "Power PC 601"
	Case 34
		FamilyResults = "Power PC 603"
	Case 35
		FamilyResults = "Power PC 603+"
	Case 36
		FamilyResults = "Power PC 604"
	Case 37
		FamilyResults = "Power PC 620"
	Case 38
		FamilyResults = "Power PC X704"
	Case 39
		FamilyResults = "Power PC 750"
	Case 48
		FamilyResults = "Alpha Family"
	Case 49
		FamilyResults = "Alpha 21064"
	Case 50
		FamilyResults = "Alpha 21066"
	Case 51
		FamilyResults = "Alpha 21164"
	Case 52
		FamilyResults = "Alpha 21164PC"
	Case 53
		FamilyResults = "Alpha 21164a"
	Case 54
		FamilyResults = "Alpha 21264"
	Case 55
		FamilyResults = "Alpha 21364"
	Case 64
		FamilyResults = "MIPS Family"
	Case 65
		FamilyResults = "MIPS R4000"
	Case 66
		FamilyResults = "MIPS R4200"
	Case 67
		FamilyResults = "MIPS R4400"
	Case 68
		FamilyResults = "MIPS R4600"
	Case 69
		FamilyResults = "MIPS R10000"
	Case 80
		FamilyResults = "SPARC Family"
	Case 81
		FamilyResults = "SuperSPARC"
	Case 82
		FamilyResults = "microSPARC II"
	Case 83
		FamilyResults = "microSPARC IIep"
	Case 84
		FamilyResults = "UltraSPARC"
	Case 85
		FamilyResults = "UltraSPARC II"
	Case 86
		FamilyResults = "UltraSPARC IIi"
	Case 87
		FamilyResults = "UltraSPARC III"
	Case 88
		FamilyResults = "UltraSPARC IIIi"
	Case 96
		FamilyResults = "68040"
	Case 97
		FamilyResults = "68xxx Family"
	Case 98
		FamilyResults = "68000"
	Case 99
		FamilyResults = "68010"
	Case 100
		FamilyResults = "68020"
	Case 101
		FamilyResults = "68030"
	Case 112
		FamilyResults = "Hobbit Family"
	Case 120
		FamilyResults = "Crusoe TM5000 Family"
	Case 121
		FamilyResults = "Crusoe TM3000 Family"
	Case 122
		FamilyResults = "Efficeon8000 Family"
	Case 128
		FamilyResults = "Weitek"
	Case 130
		FamilyResults = "Itanium™ Processor"
	Case 131
		FamilyResults = "AMD Athlon™"
	Case 132
		FamilyResults = "AMD Opteron™ Family"
	Case 144
		FamilyResults = "PA-RISC Family"
	Case 145
		FamilyResults = "PA-RISC 8500"
	Case 146
		FamilyResults = "PA-RISC 8000"
	Case 147
		FamilyResults = "PA-RISC 7300LC"
	Case 148
		FamilyResults = "PA-RISC 7200"
	Case 149
		FamilyResults = "PA-RISC 7100LC"
	Case 150
		FamilyResults = "PA-RISC 7100"
	Case 160
		FamilyResults = "V30 Family"
	Case 176
		FamilyResults = "Pentium III Xeon"
	Case 177
		FamilyResults = "Pentium III Processor with Intel SpeedStep Technology"
	Case 178
		FamilyResults = "Pentium 4"
	Case 179
		FamilyResults = "Intel Xeon"
	Case 180
		FamilyResults = "AS400 Family"
	Case 181
		FamilyResults = "Intel Xeon processor MP"
	Case 182
		FamilyResults = "AMD AthlonXP Family"
	Case 183
		FamilyResults = "AMD AthlonMP Family"
	Case 184
		FamilyResults = "Intel Itanium 2"
	Case 185
		FamilyResults = "Intel Pentium M Processor"
	Case 190
		FamilyResults = "K7"
	Case 200
		FamilyResults = "IBM390 Family"
	Case 201
		FamilyResults = "G4"
	Case 202
		FamilyResults = "G5"
	Case 203
		FamilyResults = "G6"
	Case 204
		FamilyResults = "z/Architecture base"
	Case 250
		FamilyResults = "i860"
	Case 251
		FamilyResults = "i960"
	Case 260
		FamilyResults = "SH-3"
	Case 261
		FamilyResults = "SH-4"
	Case 280
		FamilyResults = "ARM"
	Case 281
		FamilyResults = "StrongARM"
	Case 300
		FamilyResults = "6x86"
	Case 301
		FamilyResults = "MediaGX"
	Case 302
		FamilyResults = "MII"
	Case 320
		FamilyResults = "WinChip"
	Case 350
		FamilyResults = "DSP"
	Case 500
		FamilyResults = "Video Processor"
End Select
End Function

Function getComputer()
	Dim objNet
	Set objNet = WScript.CreateObject("WScript.Network") 
	getComputer = objNet.ComputerName 
	Set objNet = Nothing 
End Function

Function errorChecking(computername) 
errorChecking = False 
if err.number <> 0 then 
	wscript.echo "Unable to connect to " & ucase(computername)
	err.Clear () 
	errorChecking = True
end if 
end Function
