Monday, July 4, 2011

Identifying Processor Type & Inventorying Computer Hardware



INVENTORY OF A COMPUTER WITH WINDOWS
Pripared by Laxman,

Identifying Processor Type




Determines the processor architecture (such as x86 or ia64) for a specified computer.
========================


strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objProcessor = objWMIService.Get("win32_Processor='CPU0'")

If objProcessor.Architecture = 0 Then
    Wscript.Echo "This is an x86 computer."
ElseIf objProcessor.Architecture = 1 Then
    Wscript.Echo "This is a MIPS computer."
ElseIf objProcessor.Architecture = 2 Then
    Wscript.Echo "This is an Alpha computer."
ElseIf objProcessor.Architecture = 3 Then
    Wscript.Echo "This is a PowerPC computer."
ElseIf objProcessor.Architecture = 6 Then
    Wscript.Echo "This is an ia64 computer."
Else
    Wscript.Echo "The computer type could not be determined."
End If
========================
Save the script as Filename.vbs, And just double click on that.

Inventorying Computer Hardware


Inventorying Computer Hardware



Returns information about the pointing devices installed on a computer. Used as an example of how to retrieve hardware information using WMI.
=========================


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colMice = objWMIService.ExecQuery _
    ("Select * from Win32_PointingDevice")
For Each objMouse in colMice
    Wscript.Echo "Hardware Type: " & objMouse.HardwareType
    Wscript.Echo "Number of Buttons: " & objMouse.NumberOfButtons    
    Wscript.Echo "Status: " & objMouse.Status
    Wscript.Echo "PNP Device ID: " & objMouse.PNPDeviceID
Next
========================

Save the script as Filename.vbs, And just double click on that.



Share this

0 Comment to "Identifying Processor Type & Inventorying Computer Hardware"

Post a Comment