Working with a customer recently we wanted to deploy a ConfigMgr Application to all all laptops in the organization without creating a new collection of just laptops. Using the ChassisTypes property of the Win32_SystemEnclosure WMI namespace is a great way to do this; however, it can get a bit complicated, especially when there is non-normalized data in the inventory. An example would be a wrongly coded ChassisType.
Additionally, if you want to target only desktops and exclude virtual computers the details can get tricky if you have a diverse environment.
The script Get-ChassisTypeName.vbs (no, it isn’t PowerShell… gasp!) will return IsLaptop, IsDesktop, IsServer, and IsVirtual based on the ChassisType and an array of computer model names. For example, every Dell OptiPlex is a desktop, regardless of what the ChassisTypes property returns. Determining IsVirtual in ConfigMgr is tricky because of some underlying issues. This script removes the confusion and gets the job done.
I recommend reading Brandon Linton’s ConfigMgr 2012 Chassis Type Global Condition blog for implementing this as a ConfigMgr Global Condition.
Global Conditions don’t work in a Task Sequence, but it would be trivial to add code to populate a custom TSVariable with the result. You can rely on the source script from MDT if your TS is MDT integrated, but it doesn’t handle the edge cases and it’s a ton of overhead just to determine the Chassis Type.
Grab the script from GitHub.
IsLaptop, IsDesktop, IsServer, and IsVirtual