Updating HP Docks with Intune or ConfigMgr using PowerShell

TLDR: Function on GitHub | ConfigMgr CI / Intune PR Script on GitHub

So I’m going to cover several docks in one process. I originally started out with supporting the HP USB-C G5 Essential Dock, but I ended up going down a rabbit hole and adding several with the collaboration of my coworker Dan Felman.

Related Posts

HP White Paper: HP_Firmware_Installer_for_Docks_L33010-004.pdf

Supported Docks | Firmware Softpaq Downloads (as of 2024.04.01 when I checked last)

Recently added support in my function, but uses completely different process then newer devices, so connect with me if you run into any issues, as a lot of additional code was needed.

* Tested myself with units I have on hand
** Waiting for test Units to arrive… will update post if anything is wrong from my original findings.

Overall Process

  • Detect Dock that is attached to device
  • Download latest firmware for device (via HPCMSL if available or hardcoded URL in script)
  • Run HPFirmwareInstaller -C to run a check of the system.
  • If Check determines Update needed… continue to update… else exit

Methods to detect current HP Dock Firmware

HP Thunderbolt docks and others as well have their information in the Registry, ONCE you run the HPFirmwareInstaller.exe command. You can run this as a check, and it will add the values. However, this information for the Thunderbolt G4 dock is also available via WMI like the HP USB-C Dock G5 (see below), so that’s a good way to standardize gathering the information:

The subkey is unique as it is the Serial Number of the dock. The script I wrote will look in all child keys to find the “InstalledPackageVersion”.

HP USB-C Dock G5 (NOT the Essential dock) have their information in WMI (from what I’ve read, I’m still waiting on my test device to confirm). You do need to install the WMI provider for it, which would be in the firmware downloads for the docks. I’m using WMIExplorer to show where it is…

$computer = $env:COMPUTERNAME
$namespace = "ROOT\HP\InstrumentedServices\v1"
$classname = "HP_DockAccessory"

Write-Output "====================================="
Write-Output "COMPUTER : $computer "
Write-Output "CLASS    : $classname "
Write-Output "====================================="

Get-WmiObject -Class $classname -ComputerName $computer -Namespace $namespace |
    Select-Object * -ExcludeProperty PSComputerName, Scope, Path, Options, ClassPath, Properties, SystemProperties, Qualifiers, Site, Container |
    Format-List -Property [a-z]*

Related Posts: HP Dock WMI Provider Deployment & Inventory with ConfigMgr – GARYTOWN ConfigMgr Blog

If you download the firmware, you can grab the WMI Provider in the Manageability Folder and deploy it out, then you can use that to collect the inventory in ConfigMgr pretty easy by adding that WMI namespace for hardware inventory. Once I get one of these docks, I’ll plan to blog that process too. On my test machine, I ran HPDockWMIProvider.exe, and let it do it’s thing. The “HP Dock Accessory WMI Provider” App shows under Add / Remove programs.

HP USB-C G5 Essential Dock.. I haven’t found any place to get this without running the HPFirmwareInstaller.exe tool, which creates an output file with the information, so that’s what I end up doing.
HPFirmwareInstaller.exe -C to run a check, which creates a file called: HPFI_Version_Check.txt

Note: Error Code:105 = ‘Out – of – date firmware detected when running with ‘check’ flag.’

Custom Function: Get-HPDockUpdateDetails

iex (irm hpdock.garytown.com) will pull the script directly from GitHub, and then you can run the function, similar to how I demo in the video.
Updating HP USB-C G5 dock using the Stage feature

Based on what I learned and how to test if an update is needed, I, with the help of coworker Dan Felman, wrote a function to get information about the HP Dock attached, and update with additional parameters.

Using Get-HPDockUpdateDetails Function to Update Dock & Create Log

I’ll be running the function with three parameters:

  • UIExperience set to NonInteractive = Shows the display for the update, so user can see progress but not interfere.
  • -Update = To allow the update to happen if device finds an update available
  • -Transcript = Create a transcript log of the process in C:\swsetup\dockfirmware
Get-HPDockUpdateDetails -UIExperience NonInteractive -Update -Transcript

HP Dock Updates via Intune Proactive Remediation

For this, you’ll want to take the main script in GitHub, create two copies of it.

  • HPDockUpdater_Detect.ps1
    • Set variables: $Purpose = “IntunePR” & $Remediate = $false
  • HPDockUpdater_Remediate.ps1
    • Set variables: $Purpose = “IntunePR” & $Remediate = $true

Then upload to Intune:

HP Dock Updates via ConfigMgr Configuration Items

For this, you’ll want to take the main script in GitHub & the Detection Script in GitHub, then create a new Configuration item, choosing Windows Desktops & Servers and check the box for “This configuration item contains application settings.”

On the Detection Methods Screen, paste the Detection Script in from GitHub:

In both the Discovery & Remedition script areas, you’ll paste in the script from GitHub

Make minor adjustments on both scripts:

  • Discovery
    • Set variables: $Purpose = “ConfigMgr” & $Remediate = $false
  • Remediation
    • Set variables: $Purpose = “ConfigMgr & $Remediate = $true

On the Compliance Rules Tab, click “New”, set the Value to “Compliant”, and check the two boxes.

Then finish up, and add it to one of your baselines, or create one for it to deploy. I’ve added it to my HP Clients Baseline and make sure you set it to optional, so it only runs on devices that has a dock detected.

Note, This did work for me, however due to the amount of time the script takes to run, I did get a time out error:

But it did successfully update the Dock Firmware:

And the next time the Baseline Ran, it went back into compliance:

If a dock is not connected, it will report “Not Detected” and not impact your compliance.

PowerShell Simple Method..

If you just want to play with the function and test updating a system, grab this code, then grab the function from github and paste into that area, and trigger it.

### Grab Function Get-HPDockUpdateDetails and Paste Here: https://github.com/gwblok/garytown/edit/master/hardware/HP/Docks/Function_Get-HPDockUpdaterDetails.ps1


### Function Ends

$DockInfo = Get-HPDockUpdateDetails
if ($DockInfo.UpdateRequired -eq $true){ #Update Required
    Get-HPDockUpdateDetails -UIExperience NonInteractive -Update -Transcript 
}

Wrapping Up

With the examples I’ve provided, you can either create your own Proactive Remediation or Configuration baseline based on these two examples, or you can use any method you want leveraging the custom Get-HPDockUpdateDetails function, like scheduled tasks, Tanium, or other endpoint management systems.

Please provide feedback, as I had very limited ability to test.

GARYTOWN.COM

20 thoughts on “Updating HP Docks with Intune or ConfigMgr using PowerShell”

    • No, it’s not a matter of adding support to the WMI Provider, the essential’s dock is missing an required chip in the device that would allow for WMI Management. This was due to chip shortages and supply chain issues (I’ve been told). If it were a matter of updating code and pushing firmware update, it would have been done by now. It’s just not possible due to that hardware limitation of the dock.

      Reply
  1. Testing with a HP USB-C Dock G5, not returning the InstalledFirmware version
    This line (417)
    $VersionFile = “$PSScriptRoot\HPFI_Version_Check.txt”
    Should be
    $VersionFile = “.\HPFI_Version_Check.txt”

    Would work fine if the script is in the current working directory, but during my testing, it’s not.

    Reply
    • Thanks. I’ve updated the Function as you suggested. Once I get one of those docks for testing, I will double check things.

      Reply
  2. hi,

    Is there a switch to update on disconnect if docks supports it. I know that the G5 can do this but the G5 essential not.

    Reply
  3. Not nearly as elegant as what you’ve composed, but this how I’ve handled firmware for these to date. For me, it was essential to be able to stage the update, and support the install upon disconnect, as the install performed while docked disconnects network and monitors, and disrupts the user and creates helpdesk tickets.

    – push the extracted wmi installer to all laptops via Intune or RMM of choice
    – Run a detection script to detect existing firmware version:

    $namespace = “ROOT\HP\InstrumentedServices\v1”
    $classname = “HP_DockAccessory”
    Get-WmiObject -Class $classname -Namespace $namespace | Select-Object -expandproperty firmwarepackageversion

    – Use a regex to trigger the remediation script based on output value. Say if less than “1.0.\b([1-9]|1[0-3])\b.0”

    – download the softpaq
    cd c:\HPassets
    Get-Softpaq -number 134241 -quiet -overwrite skip

    -install the firmware msi
    msiexec /i C:\hpassets\SP134241\Manageability\HPFirmwareInstaller64.msi /qn /L*v C:\hpassets\dock.log

    -execute the stage install upon dock disconnect
    cd “C:\Program Files\HP\HP Firmware Installer\HP USB-C Dock G5”
    HPFirmwareInstaller.exe -stage -silent

    Looking forward to you updating yours to support upon disconnect so I can dump my janky method 🙂

    -As an additional note, if you run Windows Defender with ASR rules, the hpfirmwareinstaller will get blocked by the WMI based ASR rules, so make sure to exclude it as an exception.

    Reply
  4. Big thanks for your work! We apply with succes your script Function_Get-HPDockUpdaterDetails.ps1 in Ivanti End point manager for G5, G5 essential and TB G4…

    Cheers

    Reply
  5. Many thanks for the good work.

    Could you add an option to the script that interactively asks the user whether they want to perform the update now? The user must have the option of not carrying out the update for the moment.

    If the user is in a meeting or doing urgent work, network interruptions and monitor fluctuations are not desirable.

    Reply
    • I’d recommend using the stage parameter, so if the dock supports staging the update, it will not install until the laptop is disconnected.

      Other, use the function to help inventory your docks, then use your current management solution to deploy the updates using the user controls you desire.

      Example, you can use PSADT to create a process that prompts the user. You could also use a Task Sequence to achieve your goals.

      You could also have HPIA available in Software Center / Company Portal for end users to trigger manually which will also update dock firmware.

      Reply
  6. Hi Gary,
    I was running the script from here

    https://github.com/ofelman/DockUpdater/blob/main/DockUpdater.ps1

    for a “HP USB-C Dock G4” but keep this getting error but other docks like TB G2 and G4 updated successfully attached to the same laptop

    Host Application: C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -nologo -file .\HPDockingFirmwareUpdater.ps1 -Update
    Process ID: 46316
    PSVersion: 5.1.19041.4291
    PSEdition: Desktop
    PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.19041.4291
    BuildVersion: 10.0.19041.4291
    CLRVersion: 4.0.30319.42000
    WSManStackVersion: 3.0
    PSRemotingProtocolVersion: 2.3
    SerializationVersion: 1.1.0.1
    **********************
    Transcript started, output file is C:\swsetup\dockfirmware\sp88999.txt
    DockUpdater.ps1: 01.00.12 June 29, 2023
    Running script with CMSL = False
    Executing a dock firmware update
    Starting Download of http://ftp.hp.com/pub/softpaq/sp88501-89000/sp88999.exe to C:\swsetup\dockfirmware\sp88999.exe
    Extracting to C:\swsetup\dockfirmware\sp88999
    Softpaq extract returned: 1168
    Extracted Softpaq Info file: C:\swsetup\dockfirmware\sp88999\config.ini
    Softpaq for Device:
    Softpaq Version:
    **********************
    Windows PowerShell transcript end
    End time: 20240502161615
    **********************

    Reply
    • Thanks, I’ll try to look into it later. In the meantime, if you run the sp88999.exe manually, are you able to update your dock?

      Reply
      • From CurrentVersion.log
        [Cypress]
        BillBoard=0.1.0.24
        HX3u=8.10.7.183
        HX3d=0.10.7.183
        ccg4=dk.0.13.4
        [Megachips]
        Host=0.60.0.43
        port1=1.62.0.11
        port2=0.60.0.43
        [Realtek]
        Audio=4.119.0000-0002.0000
        [Main]
        CompareCount=7
        MJ3=1
        m_bUpdateRequired_Cypress=0
        m_bUpdateRequired_Megachips_Host=0
        m_bUpdateRequired_Megachips_Port1=0
        m_bUpdateRequired_Megachips_Port2=0
        m_bUpdateRequired_Audio=0
        ***************************************************************************************
        From fwupdate.log

        ***************************************************************************************
        From HP_USB-C_Dock_G4.log
        ****** ******
        ****** CCG4 Dock Solution ******
        ****** CCGx/HX3 and Billboard Unified Firmware Update Utility ******
        ****** Base Version 0.5 Tool Build 7 ******
        ****** ******
        ****** Test Release only ******
        ****** ******
        ***********************************************************************

        Please power cycle the board at the end of operation for normal functioning!

        Searching for Billboard Device . . .

        Firmware Update Device Found!
        Connected with Firmware Update Device.

        *******************************************

        ***********************************************
        BILLBOARD VERSION INFO
        ***********************************************

        Billboard Firmware Version
        ————————–
        Version : 0.1.0.24

        ***********************************************
        DOWNSTREAM HX3 VERSION INFO
        ***********************************************

        HX3 Firmware Version:
        ———————
        Version : 0.10.7.183

        ***********************************************
        UPSTREAM HX3 VERSION INFO
        ***********************************************

        HX3 Firmware Version:
        ———————
        Version : 8.10.7.183

        ***********************************************
        CCGX VERSION INFO
        ***********************************************

        CCGx Firmware Version Info.

        CCGx Firmware-1 Version:
        ————————
        Base Version : 3.0.0.762
        Application Version : dk.0.13.4

        CCGx Firmware-2 Version:
        ————————
        Base Version : 3.0.0.762
        Application Version : dk.0.12.39

        Active Firmware : Firmware-1

        CCGx Bootloader Firmware Version:
        ——————————–
        Base Version : 0.0.0.58
        Application Version : nb.0.0.1

        Success with code: 0x0
        ***************************************************************************************
        From HP Dock Firmware Update Tool (console) v5.0.2
        ====================================
        Tue May 7 10:48:57 2024
        ====================================
        New version: F.37
        Graphics adapter initialization:
        Auto scan graphics adapter (DDC2bi addr: 0x60)…
        NVidia: Library not found!
        AMD: Loading DLL… failed!
        Intel [Intel(R) Iris(R) Xe Graphics]: Init done
        Device GUID: 0x1000 [Local FP]… N/A
        Device ID: 0x0C: Gfx Error! (AUX incomplete write)
        Device ID: 0x0D: Query Error! (7) by DDC Addr (0x60)
        Device ID: 0x0E: Query Error! (7) by DDC Addr (0x60)
        Device ID: 0x0F: Gfx Error! (invalid operation type)
        ==> No available port!
        ……………………………….
        Graphics adapter initialization:
        Auto scan graphics adapter (DDC2bi addr: 0x60)…
        NVidia: Library not found!
        AMD: Loading DLL… failed!
        Intel [Intel(R) Iris(R) Xe Graphics]: Init done
        Device GUID: 0x1000 [Local FP]… N/A
        Device GUID: 0x100 [External FP]… OK
        ……………………………….
        0.60.0.43
        New F/W Version: 0.60.0.43
        1.62.0.11
        New F/W Version: 1.62.0.11
        0.60.0.43
        New F/W Version: 0.60.0.43

        Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.