Automatic driver updating for Dell and HP Machines

Driver updates, always a pain! Microsoft are fixing it with the Windows Update drivers in the update rings in Intune, but until that includes Firmware as well it’s best to use the tools available.

Fortunately, both Dell and HP offer utilities to update drivers and they both have command line switches which we can use.

Scripts are all here

To make this easier to deploy with Intune, I like to create folders to organise everything so you will find the install/uninstall commands, a text file with the detection method, an icon and an output folder with the package intunewin file.

For this I’ll run through the source folder with the script

Dell

The install.bat copies the scripts to a new folder on the c:\ drive, runs a ps1 to add a scheduled task and then installs the tool (silently)

if not exist "C:\driversupd\" mkdir C:\driversupd

copy %~dp0runupdate.bat c:\driversupd\runupdate.bat
copy %~dp0schtask.ps1 c:\driversupd\schtask.ps1

Powershell.exe -executionpolicy bypass -File  c:\driversupd\schtask.ps1

start "" Dell-Command-Update-Application_8D5MC_WIN_4.3.0_A00_01.exe /s

The powershell script registers a scheduled task to run every 2 weeks and check for updates

Edit: Replaced DriverUpdate with applyUpdates, thanks for Nicolas for spotting in the comments.

Also running the command in-line for security.

#Configure Scheduled Task for driver updates

#Set the action
$action = New-ScheduledTaskAction -Execute “C:\Program Files\Dell\CommandUpdate\dcu-cli.exe” -Argument “/applyUpdates -silent -reboot=disable -outputlog=c:\driversupd\log.log”

#Set a trigger
$trigger = New-ScheduledTaskTrigger -Weekly -WeeksInterval 2 -DaysOfWeek Friday -At 1pm 

#Set to run as system
$principal= New-ScheduledTaskPrincipal -UserID “NT AUTHORITY\SYSTEM” -LogonType “ServiceAccount” -RunLevel “Highest”

#Set a Name
$taskname = "Intune Driver Updates"

#Set a Description
$taskdescription = "Weekly driver update Friday at 13:00"

#Require AC Power
$Settings = @{
    AllowStartIfOnBatteries = $false
    DontStopIfGoingOnBatteries = $false
}
$settings= New-ScheduledTaskSettingsSet @settings


#Register the Task
Register-ScheduledTask -TaskName $taskname -Trigger $trigger -Action $action -Principal $principal -Settings $settings -Description $taskdescription -Force

HP

Similar to Dell, only using HP Image assistant

First, copy the files and install the utility. Watch the arguments here or it will launch the GUI on install

if not exist "C:\driversupd\" mkdir C:\driversupd
mkdir c:\driversupd\hp

copy %~dp0runupdate.bat c:\driversupd\runupdate.bat
copy %~dp0schtask.ps1 c:\driversupd\schtask.ps1

copy %~dp0hpupdate.exe c:\driversupd\hpupdate.exe
Powershell.exe -executionpolicy bypass -File c:\driversupd\schtask.ps1

start "" c:\driversupd\hpupdate.exe  /s /e /f c:\driversupd\hp

Create your scheduled task

#Set the action
$action = New-ScheduledTaskAction -Execute 'c:\driversupd\hp\HPImageAssistant.exe /Action:Install /AutoCleanup /Category:Drivers /Silent'

#Set a trigger
$trigger = New-ScheduledTaskTrigger -Weekly -WeeksInterval 2 -DaysOfWeek Friday -At 1pm 

#Set a Name
$taskname = "Intune Driver Updates"

#Set a Description
$taskdescription = "Weekly driver update Friday at 13:00"

#Register the Task
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName $taskname -Description $taskdescription


#Configure Scheduled Task for Firmware updates

#Set the action
$action = New-ScheduledTaskAction -Execute 'c:\driversupd\hp\HPImageAssistant.exe /Action:Install /AutoCleanup /Category:Firmware /Silent'

#Set a trigger
$trigger = New-ScheduledTaskTrigger -Weekly -WeeksInterval 2 -DaysOfWeek Friday -At 2pm 

#Set a Name
$taskname = "Intune Firmware Updates"

#Set a Description
$taskdescription = "Weekly firmware update Friday at 14:00"

#Register the Task
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName $taskname -Description $taskdescription

I’ve chosen not to update BIOS with this one, but it can be done with the inclusion of password files. A full list of options are in the manual

There we go, drivers and firmware no longer an issue!

42 thoughts on “Automatic driver updating for Dell and HP Machines”

  1. Hi Andrew,

    I have deployed the Intune win file as system, the files copy over to the C Drive correctly but the scheduled tasks fails to be created. When running the PS Script manually, the task does work. This is for the HP update.

    Thank you,
    Jazzy.

    Reply
  2. Hello Andrew,
    I could not find the Github repository for this article. Would you mind sharing it please?

    Also this works for all drivers[Audio, WIfi, DVD & so on…] for these two manufacturers[Hp & Dell] correct?

    Reply
  3. Hi,

    Great work, do you have a script for Lenovo by any chance with it having a tool called Lenovo Vantage as the driver updater.

    Thanks
    Danny

    Reply
  4. Hi Andrew!,

    I got the intune package from your github, and deployed it, but the schedule task fails to be created. I have tried to run the .\schtask.ps1 directly and I get this error:

    New-ScheduledTaskAction : A parameter cannot be found that matches parameter name ‘silent’.
    At C:\driversupd\schtask.ps1:26 char:125
    + … mmandUpdate\dcu-cli.exe†-Argument “/applyUpdates -silent -reboot …
    + ~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [New-ScheduledTaskAction], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,New-ScheduledTaskAction

    New-ScheduledTaskPrincipal : Cannot process argument transformation on parameter ‘LogonType’. Cannot convert value
    ““ServiceAccount— to type “Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.LogonTypeEnum”. Error:
    “Unable to match the identifier name “ServiceAccount†to a valid enumerator name. Specify one of the following
    enumerator names and try again:
    None, Password, S4U, Interactive, Group, ServiceAccount, InteractiveOrPassword”
    At C:\driversupd\schtask.ps1:32 char:85
    + … rID “NT AUTHORITY\SYSTEM†-LogonType “ServiceAccount†-RunLev …
    + ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (:) [New-ScheduledTaskPrincipal], ParameterBindingArgumentTransformationExc
    eption
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,New-ScheduledTaskPrincipal

    Register-ScheduledTask : Cannot validate argument on parameter ‘Action’. The argument is null or empty. Provide an
    argument that is not null or empty, and then try the command again.
    At C:\driversupd\schtask.ps1:50 char:70
    + … ledTask -TaskName $taskname -Trigger $trigger -Action $action -Princi …
    + ~~~~~~~
    + CategoryInfo : InvalidData: (:) [Register-ScheduledTask], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Register-ScheduledTask

    And the runupdate.bat had this error.
    .\runupdate.bat

    C:\driversupd>”C:\Program Files (x86)\Dell\CommandUpdate\dcu-cli.exe” /applyUpdates -silent -reboot=disable -outputlog=”c:\driversupd\log.log”
    The system cannot find the path specified.

    the intune package was deployed and showed as a success but nothing apart from c:\driversupd seem to be in the system.

    Any ideas for all this?

    Reply
  5. Hi Andrew,

    I’m currently trying to implement the HP driver into my intune environment however I’m running into issues with installing the utility and running the first script. Any ideas where I should start when setting this?

    Reply
  6. I forgot to note. Part of the issue was the arguments weren’t defined correctly when testing. They were in the execute path which task scheduler doesn’t like.

    Reply
  7. It did copy correctly and I re-tested with success for creating the scheduled task. I did, however, then have issues with how the scheduled task was configured with your scheduled task script. After modifications I have came to land at this for that (this allowed me to run this as system which was needed as well as required to be plugged in which I discovered was necessary as I had firmware updates come through):

    $schtaskDescription = “Bi-weekly driver update Friday at 12:00”
    $taskname = “Intune Driver Updates”
    $trigger = New-ScheduledTaskTrigger -Weekly -WeeksInterval 2 -DaysOfWeek Friday -At 12pm
    $principal= New-ScheduledTaskPrincipal -UserID “NT AUTHORITY\SYSTEM” -LogonType “ServiceAccount” -RunLevel “Highest”
    $action = New-ScheduledTaskAction -Execute “C:\Program Files\Dell\CommandUpdate\dcu-cli.exe” -Argument “/applyUpdates -silent -reboot=disable -outputlog=c:\driversupd\log.log”
    $settings= New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries = $false -DontStopIfGoingOnBatteries = $false

    Register-ScheduledTask -TaskName $taskname -Trigger $trigger -Action $action -Principal $principal -Settings $settings -Description $schtaskDescription -Force

    Reply
  8. Hey Andrew,

    Thanks for the reply. I couldn’t find your email address looking through the site. The install.bat ran and created the folders properly, copied the files, and installed Dell Command Update on my test PC. However, it did not create the scheduled task via the powershell script.

    Reply
  9. I modified this to update the newest version of Dell Command Update.

    I am having issues though as now the powershell call isn’t running automatically. It dropped the files but didn’t run. I had to run it manually. Thoughts?

    Reply
  10. Hello Andrew,

    Regarding your script,

    To launch Dell command update in cli you use the command :

    dcu-cli.exe /driverinstall

    This CLI option installs all the base drivers for the present configuration on a newly installed Windows operating system.

    Don’t you think we should run the following command instead :

    dcu-cli.exe /applyUpdates

    Applies all updates for the current system configuration.

    The idea is that at the preload install dell driver package and then only launch periodically the updates ?

    Reply
    • Hi Nicolas,

      Thanks for spotting that, definitely makes more sense to update as these are post install.

      I have updated the post and the github scripts / win32 app

      I’ve also put the command in-line instead of launching a batch script for a bit of added security.

      Reply
  11. Yes, I can see a key as you have mentioned and under there I see the data related to Google Chrome
    Nothing more 🙁

    Reply
  12. Hey Andrew,

    I have implemented this in our organization but with changes to run the scheduled task with ‘NT AUTHORITY\SYSTEM’ account and to run with highest privilege. Today when running the task I’m getting result as ‘(0x5)’. At the same time, a different task using same ‘NT AUTHORITY\SYSTEM’ and high privilege works without any problem.

    Can you help me ?

    Reply
    • Hi,
      An 0x5 error is normally to do with permissions, it might be worth checking the permissions on the files/folder the task is running to check there isn’t something odd happening there.

      You could also try running manually using psexec in the system context ( PsExec.exe -i -s cmd.exe) – This will give you a command prompt running as system so you can test.

      If that doesn’t help, let me know which you’re running and I’ll do some testing too

      Reply
      • Thank you for your reply Andrew…!

        I have checked on the permissions for the files and folder, System account has right permissions there.

        When I tried running PsExec.exe -i -s cmd.exe, it says ”PsExec.exe’ is not recognized as an internal or external command, operable program or batch file.’

        I have tried running this as normal user and also as administrator. It’s very strange that it worked for the first times successfully for dell update and now it fails. At the same time it works perfectly for a different task.

        It would be great if you could help here

        Reply
          • Hey Andrew

            Not before your comment, but now I have downloaded and tried running the same command after extracting the file to the working directory. But throws error as ‘Access is denied’ when running as normal user without admin privilege.

            When I try to run as admin, it throws error as ‘PsExec could not start cmd.exe on Hostname:
            The system cannot find the file specified.’

            As the next item, I tried executing runupdate.bat as admin from command. It throws error as below

            ‘A previous operation requires a system reboot to complete. You may execute this command after the system has restarted.
            The program exited with return code: 5’

            I have checked under HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired and HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending, Both are false. I have also just restarted the computer few minutes before.

  13. Since you are using powershell, before line 6, you can add these lines:

    cd $ENV:UserProfile\Downloads
    wget “https://dl.dell.com/FOLDER07582763M/5/Dell-Command-Update-Application-for-Windows-10_GRVPK_WIN_4.3.0_A00_03.EXE”

    Reply

Leave a Comment