Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Determine if machine is a desktop or laptop.

Featured Replies

Is it possible to determine at some point if the installation is beeing run on a laptop or dekstop?

I'm asking cause id like to be able to set powersaving settings, graphical settings, WLAN settings etc. conditionally to if it's a desktop computer or a lappy.

:hello:

yep - you can do this using a simple WMI query once the windows shell has loaded.

Sample vb script:

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colChassis = objWMIService.ExecQuery _

("Select * from Win32_SystemEnclosure")

For Each objChassis in colChassis

For i = Lbound(objChassis.ChassisTypes) to Ubound(objChassis.ChassisTypes)

Wscript.Echo objChassis.ChassisTypes(i)

Next

Next

---------------------------------------------------------------------

ChassisTypes

Data type: uint16 array

Access type: Read-only

Array of chassis types. This property is inherited from CIM_Chassis.

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 Hand Held

12 Docking Station

13 All in One

14 Sub Notebook

15 Space-Saving

16 Lunch Box

17 Main System Chassis

18 Expansion Chassis

19 SubChassis

20 Bus Expansion Chassis

21 Peripheral Chassis

22 Storage Chassis

23 Rack Mount Chassis

24 Sealed-Case PC

  • Author

Pizza box hehe cool! Uhm I didnt really understand much of that query, care to give me a sample in use? Like call XX batch if Notebook else call XXX batch if Pizza box etc.?

getchassis.vbs

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colChassis = objWMIService.ExecQuery _

("Select * from Win32_SystemEnclosure")

For Each objChassis in colChassis

strType = objChassis.ChassisTypes(i)

Next

If strType = "5" Then

' Pizza box type, so run pizza type chassis commands here via more vbscript code

End If

Here is A VBS script I found at Hey,Scripting Guy! I added a function for the desktop as a example

of how to do some thing if a match is found.

strComputer = "."

Dim Act

Set Act = CreateObject("Wscript.Shell")

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

Act.Popup "Other" ,5,"Computer Type", 0 + 32

Case 2

Act.Popup "Unknown" ,5,"Computer Type", 0 + 32

Case 3

DeskTop

Case 4

Act.Popup "Low Profile Desktop" ,5,"Computer Type", 0 + 32

Case 5

Act.Popup "Pizza Box" ,5,"Computer Type", 0 + 32

Case 6

Act.Popup "Mini Tower" ,5,"Computer Type", 0 + 32

Case 7

Act.Popup "Tower" ,5,"Computer Type", 0 + 32

Case 8

Act.Popup "Portable" ,5,"Computer Type", 0 + 32

Case 9

Act.Popup "Laptop" ,5,"Computer Type", 0 + 32

Case 10

Act.Popup "Notebook" ,5,"Computer Type", 0 + 32

Case 11

Act.Popup "Handheld" ,5,"Computer Type", 0 + 32

Case 12

Act.Popup "Docking Station" ,5,"Computer Type", 0 + 32

Case 13

Act.Popup "All-in-One" ,5,"Computer Type", 0 + 32

Case 14

Act.Popup "Sub-Notebook" ,5,"Computer Type", 0 + 32

Case 15

Act.Popup "Space Saving" ,5,"Computer Type", 0 + 32

Case 16

Act.Popup "Lunch Box" ,5,"Computer Type", 0 + 32

Case 17

Act.Popup "Main System Chassis" ,5,"Computer Type", 0 + 32

Case 18

Act.Popup "Expansion Chassis" ,5,"Computer Type", 0 + 32

Case 19

Act.Popup "Sub-Chassis" ,5,"Computer Type", 0 + 32

Case 20

Act.Popup "Bus Expansion Chassis" ,5,"Computer Type", 0 + 32

Case 21

Act.Popup "Peripheral Chassis" ,5,"Computer Type", 0 + 32

Case 22

Act.Popup "Storage Chassis" ,5,"Computer Type", 0 + 32

Case 23

Act.Popup "Rack Mount Chassis" ,5,"Computer Type", 0 + 32

Case 24

Act.Popup "Sealed-Case PC" ,5,"Computer Type", 0 + 32

Case Else

Act.Popup "Unknown" ,5,"Computer Type", 0 + 32

End Select

Next

Next

Function DeskTop

Act.Popup "Desktop" ,5,"Computer Type", 0 + 32

End Function

A twist on the others, that I find easier to read:

Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."

Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Setup"
objReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath

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
strEntryName = "MACHINETYPE"
strValue = "Other"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 2
strEntryName = "MACHINETYPE"
strValue = "Unknown"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 3
strEntryName = "MACHINETYPE"
strValue = "Desktop"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 4
strEntryName = "MACHINETYPE"
strValue = "Low_Profile_Desktop"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 5
strEntryName = "MACHINETYPE"
strValue = "Pizza_Box"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 6
strEntryName = "MACHINETYPE"
strValue = "Mini_Tower"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 7
strEntryName = "MACHINETYPE"
strValue = "Tower"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 8
strEntryName = "MACHINETYPE"
strValue = "Portable"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 9
strEntryName = "MACHINETYPE"
strValue = "Laptop"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 10
strEntryName = "MACHINETYPE"
strValue = "Notebook"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 11
strEntryName = "MACHINETYPE"
strValue = "Handheld"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 12
strEntryName = "MACHINETYPE"
strValue = "Docking_Station"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 13
strEntryName = "MACHINETYPE"
strValue = "All-in-One"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 14
strEntryName = "MACHINETYPE"
strValue = "Sub-Notebook"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 15
strEntryName = "MACHINETYPE"
strValue = "Space_Saving"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 16
strEntryName = "MACHINETYPE"
strValue = "Lunch_Box"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 17
strEntryName = "MACHINETYPE"
strValue = "Main_System_Chassis"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 18
strEntryName = "MACHINETYPE"
strValue = "Expansion_Chassis"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 19
strEntryName = "MACHINETYPE"
strValue = "Sub-Chassis"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 20
strEntryName = "MACHINETYPE"
strValue = "Bus_Expansion_Chassis"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 21
strEntryName = "MACHINETYPE"
strValue = "Peripheral_Chassis"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 22
strEntryName = "MACHINETYPE"
strValue = "Storage_Chassis"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 23
strEntryName = "MACHINETYPE"
strValue = "Rack_Mount_Chassis"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case 24
strEntryName = "MACHINETYPE"
strValue = "Sealed-Case_PC"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Case Else
strEntryName = "MACHINETYPE"
strValue = "Unknown"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
End Select
Next
Next

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.