Prev: CLICK AND GET $1000 TO YOUR HOME.
Next: Use Macro to Select printer in Word 2007 on Windows 7 Pro
From: javagopi on 29 Jun 2010 07:25 strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colChassis = objWMIService.ExecQuery _ ("Select * from Win32_SystemEnclosure") For Each objChassis in colChassis For Each strChassisType in objChassis.ChassisTypes Select Case strChassisType Case 1 Wscript.Echo "Other" Case 2 Wscript.Echo "Unknown" Case 3 Wscript.Echo "Desktop" Case 4 Wscript.Echo "Low Profile Desktop" Case 5 Wscript.Echo "Pizza Box" Case 6 Wscript.Echo "Mini Tower" Case 7 Wscript.Echo "Tower" Case 8 Wscript.Echo "Portable" Case 9 Wscript.Echo "Laptop" Case 10 Wscript.Echo "Notebook" Case 11 Wscript.Echo "Handheld" Case 12 Wscript.Echo "Docking Station" Case 13 Wscript.Echo "All-in-One" Case 14 Wscript.Echo "Sub-Notebook" Case 15 Wscript.Echo "Space Saving" Case 16 Wscript.Echo "Lunch Box" Case 17 Wscript.Echo "Main System Chassis" Case 18 Wscript.Echo "Expansion Chassis" Case 19 Wscript.Echo "Sub-Chassis" Case 20 Wscript.Echo "Bus Expansion Chassis" Case 21 Wscript.Echo "Peripheral Chassis" Case 22 Wscript.Echo "Storage Chassis" Case 23 Wscript.Echo "Rack Mount Chassis" Case 24 Wscript.Echo "Sealed-Case PC" Case Else Wscript.Echo "Unknown" End Select Next Next
From: Pegasus [MVP] on 29 Jun 2010 08:35 > Case 3 > Wscript.Echo "Desktop" > Case 9 > Wscript.Echo "Laptop" Probably Case 3 and Case 9.
From: Mayayana on 29 Jun 2010 09:35 I wouldn't depend on that test if it's important. The info. is only as good as what's available to WMI, which varies. I built my own system with an Asus motherboard and AMD CPU, which I installed in a generic box that I turned sideways because I wanted a true "Desktop". (Horizontal PC) But when I run this code: Set WMI = GetObject("winmgmts:") Set SysEnc = WMI.ExecQuery("Select * from Win32_SystemEnclosure") For Each Sys in SysEnc MsgBox Sys.ChassisTypes(0) & vbCrLf & Sys.Description & vbCrLf & Sys.Height & vbCrLf & Sys.Name & vbCrLf & Sys.Model Next Set SysEnc = Nothing Set WMI = Nothing the return is: 6 SystemEnclosure - SystemEnclosure - There's no value at all in the TypeDescriptions array. So I have a mini-tower ....except that I don't. :) I'm guessing that value was probably based on info. from the motherboard, which has a "microATX" form factor.
|
Pages: 1 Prev: CLICK AND GET $1000 TO YOUR HOME. Next: Use Macro to Select printer in Word 2007 on Windows 7 Pro |