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.
Tutorial • 22 April 2020
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.
Value | Meaning |
1 | Other |
2 | Unknown |
3 | Desktop |
4 | Low Profile Desktop |
5 | Pizza Box |
6 | Mini Tower |
7 | Tower |
8 | Portable |
9 | Laptop |
10 | Notebook |
11 | Handheld |
12 | Docking Station |
13 | All-in-One |
14 | Sub-Notebook |
15 | Space Saving |
16 | Lunch Box |
17 | Mini System Chassis |
18 | Expansion Chassis |
19 | Sub-Chassis |
20 | Bus Expansion Chassis |
21 | Peripheral Chassis |
22 | Storage Chassis |
23 | Rack Mount Chassis |
24 | Sealed-Case PC |
Good luck!