Home » Windows » Autopilot » Automatically install the latest HP drivers during Autopilot provisioning

Automatically install the latest HP drivers during Autopilot provisioning

Managing drivers when provisioning Windows 10 device using Autopilot, there’s currently not any native built-in functionality in Microsoft Intune to ensure the device is provided to the end-user with the latest and greatest drivers available from the manufacturer, in this case HP. We’re currently in the hands of HP to provide the drivers injected into the image that’s shipped on the device. But what if we could actually control this, using the tools available from HP? That’s what this blog post is going to cover.

Before we dig into how we can accomplish that, I want to shout out to Bruce Sa (@BruceSaaaa) who originally came up with the idea behind the method that I’ll be sharing in this post. I’ve taken Bruce’s approach and expanded it into a fully fledged script version with extended logging and a single script file instead of multiple.

The idea here, using Bruce’s original idea, is to use the HPCMSL PowerShell module to download and run HP Image Assistant to download and apply the required drivers and driver software applicable for the current device that’s being provisioned. This method can easily be a part of a regular User Driven provisioning but also fits perfect with White Glove provisioning flows with Autopilot.

Download the script

Download the following script from our GitHub repository:

Save it as Invoke-HPDriverUpdate.ps1 in e.g. C:\IntuneWinAppUtil\Source\Drivers, as we’ll use it later when packaging this script as a Win32 app.

Prepare additional script files

For the Win32 app that we’re going to create, an additional script file is required as a Requirement Rule. Save the following PowerShell code as a file called Invoke-HPDriverUpdateRequirementRule.ps1:

$Manufacturer = (Get-WmiObject -Class "Win32_ComputerSystem" | Select-Object -ExpandProperty Manufacturer).Trim()
switch -Wildcard ($Manufacturer) {
    "*HP*" {
        Write-Output -InputObject "HP"
    "*Hewlett-Packard*" {
        Write-Output -InputObject "HP"
    default {
        Write-Output -InputObject $Manufacturer

This script file will ensure that the Win32 app is only executed on HP devices.

Package the script as a Win32 app

The process for packaging scripts as a Win32 app is just the same as for any other application. Packaging the script as a Win32 app allows us to track the driver installation process initiated by HP Image Assistant and wait for it to complete before the end-user arrives at the desktop, but it’s especially important to track this process to support White Glove. So, let’s start by packaging the script saved from GitHub above.

For this we have a few options. I’ve previously blogged about a PowerShell module called IntuneWin32App that I’ve written. I frequently use this to package and create Win32 apps. In the instructions below, I’ll reference this module, but you can also download the IntuneWinAppUtil.exe packaging utility yourself from here.

Start by installing the module if you don’t already have it:

Install-Module -Name IntuneWin32App

Once the module is installed, we’ll use the New-IntuneWin32AppPackage function to create the .intunewin file that contains the Invoke-HPDriverUpdate.ps1 script file. Call the function using the following command, where the input parameters should references the path structure in your environment (below is just an example):

New-IntuneWin32AppPackage -SourceFolder C:\IntuneWinAppUtil\Source\Drivers -SetupFile "Invoke-HPDriverUpdate.ps1" -OutputFolder C:\IntuneWinAppUtil\Output

As per the above screenshot, the packaged .intunewin file has successfully been created in C:\IntuneWinAppUtil\Output and is called Invoke-HPDriverUpdate.intunewin. This is the file that we now need to reference when creating the Win32 app in the next step.

Create the Win32 app

From within the Microsoft Endpoint Manager portal (, go to Apps – Windows and create a new by clicking the Add button.

In the Select app type blade that appears on the right side, select Windows app (Win32) and click Select.

Click Select app package file:

In the window that appears on the right, browse and select the Invoke-HPDriverUdpdate.intunewin file and click OK:

Configure the app information accordingly to your requirements, for example like shown in the below screenshot and click Next when ready:

In the Program configuration blade, configure the following as the Install command:

powershell.exe -ExecutionPolicy Bypass -Command "& '.\Invoke-HPDriverUpdate.ps1' -RunMode Stage"

And use the following Uninstall command:

cmd.exe /c

In addition, configure the Device restart behavior as No action. Leave the default return codes and click Next.

In the Requirements blade, configure the desired Operating system architecture and Minimum operating system version. Click on Add under Configure additional requirement rules.

Select the Requirement rule to a Script.

Since this Win32 app is going to install the latest drivers for HP devices, we’d want to add a custom PowerShell script requirement rule that ensures that it’s only executed on eligible devices, HP devices that is, using the Invoke-HPDriverUpdateRequirementRule.ps1 script file that we created earlier.

Click the browse button next to Script file and select the Invoke-HPDriverUpdateRequirementRule.ps1 file:

Configure the Select output data type as String, with the operator Equals and the value HP:

Click OK and Next when ready with the Requirement rule configuration.

As for Detection Rules, select Manually configure detection rules as Rule format and click Add:

As the Rule type, select Registry and configure the following:

  • Key path:
  • Value name:
    • ExecutionResult
  • Detection method:
    • String comparison
  • Operator:
    • Equals
  • Value:
    • Success

The Invoke-HPDriverUpdate.ps1 script creates the above registry value with a string of Success if it completes the driver installation process successfully. Click OK and click Next when ready.

Skip the Dependencies blade as no configuration is required here, the same goes for Scope tags. For assignment, I’ll suggest that you target a group of devices and not users. If the Win32 app is going to be used for White Glove, device targeting is preferred but not required. As for regular User Driven provisioning, either User or Device targeting works, however I usually target apps towards devices when they’re meant to be installed on all devices during provisioning.

On the final configuration blade Review + Create, validate your configuration and click Create. Once the app is created the Invoke-HPDriverUpdate.intunewin file is uploaded to Intune and the app should look similar to this:

Track the app in Enrollment Status Page

In order to be able to track the Win32 app during Autopilot provisioning, it’s required to add the newly created app to your Enrollment Status Page configuration, as shown below, unless you have it configured to track all assigned apps instead of only the selected.


With the Win32 app created and assigned to devices, the progress can be tracked in a log file created locally on the device called HPDriverUpdate.log located under C:\Windows\Temp.

Additionally, the script also stores the log files created by HP Image Assistant in the following location, so that the results of what drivers where applied is available for examination if required:

  • C:\Windows\Temp\HPIALogs

With that, installing the latest drivers for HP devices can now be accomplished when provisioning devices using Autopilot.


Nickolaj Andersen

Chief Technical Architect and Enterprise Mobility MVP since 2016. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows devices and deployments including automation. Awarded as PowerShell Hero in 2015 by the community for his script and tools contributions. Creator of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService to name a few. Frequent speaker at conferences such as Microsoft Ignite, NIC Conference and IT/Dev Connections including nordic user groups.


  • Thx – for testing on a single HP Client Device (before doing the Intune App Setup). Should this also work when only executing the Invoke-HPDriverUpdate.ps1 with admin rights?

    We are getting an error at line 294 where he says he doesnt find a ps1 file type


    • Hi Pascal,

      Try running the script locally from a directory without any spaces in the path, e.g. C:\Temp. It could be a bug like that causing the re-invoke of the script itself to fail.


  • Love it. Will you be following the same process for Lenovo. Looking forward to it.

    • Hi Jon,

      I have very little, next to nothing, experience with Lenovo unfortunately. I don’t expect to make anything similar for Lenovo in the near future, as none of my current engagements deals with that vendor, unfortunately. Maybe in the future 🙂




Do you want to be notified of new posts on our site?

Please enter your email address below:

Categories use cookies to ensure that we give you the best experience on our website.