Get your Machine Type via VBScript

This post is over a year old, the information may no longer be up to date.

This post was migrated from an old custom CMS. Some data may not look accurate.

I found myself a few weeks ago needing to find a way to get the type of machine for a program I am building, there’s a few way to do this but the easiest way I found to do it at the time was via VBS.  I’m unsure if anyone will find this useful, but I know I’ll likely come back to this at one point.

1
2
3
4
5
6
7
8
9
strName = "." 'Computer name, if local just use a period.

Set objWMI = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strName & "\root\cimv2")

For Each obj in objWMI.ExecQuery ("Select * from Win32_SystemEnclosure")
    For Each strChassisType in obj.ChassisTypes
        Wscript.Echo strChassisType
    Next
Next

The above, if saved in a notepad and saved as a .vbs script will come back with a number, the below table outlines what each number means.

ValueMeaning
1Other
2Unknown
3Desktop
4Low Profile Desktop
5Pizza Box
6Mini Tower
7Tower
8Portable
9Laptop
10Notebook
11Handheld
12Docking Station
13All-in-One
14Sub-Notebook
15Space Saving
16Lunch Box
17Mini System Chassis
18Expansion Chassis
19Sub-Chassis
20Bus Expansion Chassis
21Peripheral Chassis
22Storage Chassis
23Rack Mount Chassis
24Sealed-Case PC

Good luck!