SCCM – App Requirement to detect laptops

I have an application I need to push out to only laptops that are used by a specific AD user group. I already have a collection set up to target my AD group, but I didn’t have a filter to target just the laptops.
To do this, I created a new global condition called Hardware Type. This houses a PowerShell script that checks the model against a known list of laptop model names and returns back either “Desktop” or “Laptop” as appropriate. From there, I can add the custom condition to my application and make sure that it only installs for users in my collection that have a laptop.

I named my Global Condition Hardware Type. It’s a Windows Setting and the setting type is Script and the data type is String.
Here’s my script (we’re mostly an HP shop and these are the models I use to identify laptops):

$Model = (Get-WMIObject win32_ComputerSystem).Model
$LaptopModels = @("Surface","EliteBook","Spectre","ZBook","Elite x2")
$LaptopModels | ForEach-Object { if ($Model.Contains($_)) { $LaptopDetected = $True } }
if ($LaptopDetected) { "Laptop" } else { "Desktop" }

From there, I just had to add a Requirement that Hardware Type = “Laptop”.

Share this Story:
  • facebook
  • twitter
  • gplus

Leave a comment