This post I’m going to cover creating a Global Condition to detect if HP Docks are connected to a Windows Device. This will make targeting the HP Dock Update Application possible, which I’ll cover in the next post.
TLDR: Global Condition on GitHub: ConfigMgr_HPDock_GlobalCondition.ps1
I’m going to assume you already know about Global Conditions and how they work, here are some links to related materials to familiarize you if needed:
- Create global conditions – Configuration Manager | Microsoft Learn
- Manufacturer Global Condition for App Model – GARYTOWN ConfigMgr Blog
PowerShell Detection Script
To detect if a dock is connected, we’re going to see if it’s Hardware Device ID is present. We’ll first grab the PNP Signed Drivers
$PnpSignedDrivers = Get-CimInstance win32_PnpSignedDriver
Once we have that list, we see if we get a match with the following info:
USB-C G4 - VID_03F0&PID_484A
USB-C G5 - VID_03F0&PID_046B - Adicora A
USB-C G5 Essential Dock - VID_03F0&PID_379D - Adicora R
USB-C Universal - VID_17E9&PID_600A
USB-C Universal G2 - VID_03F0&PID_0A6B - Adicora D
TB G2 Dock - VID_03F0&PID_0667 - Hook
TB G4 Dock - VID_03F0&PID_0488 - Hook2
HP E24d G4 FHD Docking Monitor - VID_03F0&PID_056D - Hughes /24
HP E27d G4 QHD Docking Monitor - VID_03F0&PID_016E - Hughes /27
We’ll loop through and see if we find anything:
We’ll then setup our Return Values:
Running the Global Condition PowerShell Script on a test machine:
It returns 2, which lets us know that I have an HP Thunderbolt Dock G2 connected.
- Device type: Windows
- Condition type: Setting
- Setting type: Script
- Data type: String
- Discovery Script: ConfigMgr_HPDock_GlobalCondition.ps1
On an endpoint where I have an application deployed that uses this global condition:
It detects that I have the USB-C G5 dock attached to the device, and not the other docks. You can see the eval shows as “Applicable.”
On the Application Deployment Type
I’ve added the Global Condition for the “HP Dock Attached”, and set the value to 2, which was the corresponding Dock number in the custom script we created.
In the next post, I’ll show creating the Application & Deployment Types for the HP Docks.