Jump to content
limp15000

HP driver update script...

Recommended Posts

Hi all,

So with all the different security issues around Intel I thought this was really the time to focus on finding a solution to deploy drivers and possible firmwares in automated fashion.

Goal was also if possible to be able to use this for customers without Automate. 

Like everyone I started googling to find information in december. By chance I stumbled on a post in january pointing me in the right direction. HP Softpaq Download manager has command line switches which you can see if you press CTRL + SHIFT + Y when the program is running.

hp_cli.PNG.8a4d4da367fb903069650e26ad061068.PNG

Then quickly tried to through a script together which was failing without giving an error. 

@DarrenWhite99 pointed me to one of his comments which was very helpful : 

Long story short when HP SDM is run from SYSTEM it will try to download to the TEMP environment variable which points to c:\users\blabla\appdata\local\temp which you guessed it doesn't exist when in the system context. Once you set the variables the tool works as expected instead of closing without downloading and without giving an error message.

Now my other issue was that the categories and priorities are not always what you would like. Fortunatly that is easy to fix. When you edit HP SDM's configuration it will change the Defaults.sdm file (which is XML). This allows you to specify the guest OS and drivers you will be targetting with SDM. 

Testing was quite successful on computers in our office and on customer sites.

https://github.com/limp15000/ConnectWise-Automate-HP-Driver-Update

Edited by limp15000
  • Like 1

Share this post


Link to post
Share on other sites

This is awesome. I had looked into automating SDM a while back and I had not figured out how to exclude the bloatware. Will be testing this out!

Share this post


Link to post
Share on other sites

I've fixed a small glitch in my install script. Also added the search we use to autodeploy SDM on HP workstations.

Will also upload a modified version of @SteveIT BIOS install script which leverages SDM and the EDF.

Share this post


Link to post
Share on other sites

After some extensive tests I am now pushing to prod in our company today. If no issues arrise will push to all client workstations.

Share this post


Link to post
Share on other sites

New version of HP SDM. And if autoupdate is ticket this will break my script. Updating script with new versions. I've also unticked the autoupdate in my SDM settings and pushed this to all computers. No wonder my report wasn't working anymore.

Of course HP didn't yet bother to update the links on their site.

Share this post


Link to post
Share on other sites

This is something we are looking at now very interesting I assumed they were going to have a tool for this but I guess not. Thanks for the script!

Share this post


Link to post
Share on other sites

If you want to use a remote monitor to check for updates, I worked this method out this afternoon. Call it from a remote monitor using EXE monitor with command. Caveat is that this only works if the IE first run wizard is disabled, which can be done via group policy or via the registry.

Reg add "HKLM\Software\Policies\Microsoft\Internet Explorer\Main" /v "DisableFirstRunCustomize" /t REG_DWORD /d "1" /f
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass $ErrorActionPreference = 'SilentlyContinue';$response = Invoke-WebRequest -Uri 'http://ftp.hp.com/pub/caps-softpaq/cmit/HP_SDM.html';[string]$elements = $response.AllElements | Where-Object {$_.tagName -like 'H3' -and $_.innerText -match 'VERSION'} | Select -First 1 -ExpandProperty innerText;$latest = $elements -replace ('VERSION ', '');if($latest -notmatch '^(\d+\.\d+\.\d+\.\d+)$'){$latest=$latest+'.0'};$dir = (${env:ProgramFiles(x86)}, ${env:ProgramFiles} -ne $null)[0];$path=$dir+'\HP\HP SoftPaq Download Manager\SoftPaqDownloadManager.exe';$v=(Get-Item -Path $path).VersionInfo.FileVersion;$v.Equals($latest)

 

Edited by Joe.McCall
Updated the powershell on the remote monitor to fix false positives; version 4.4.0 file version is 4.4.0.0, like the previous 4.3.23.0 version, so I added a regex match to make sure the web version is in format 0.0.0.0. Added missing logic for x86/x64.

Share this post


Link to post
Share on other sites

Interesting Joe. Unfortunately last time they updated SDM it took them 2 or 3 weeks to update that site :P

But my script stopped working the same day because it was seeing the new version and quitting.

I have removed the version check in the SDM settings.

Share this post


Link to post
Share on other sites

Thanks again for your work on this! I took the latest batch of scripts and ran with those to build out a solution for on-demand and monitor-based functionality for our system, so I wanted to share them back here in case anyone else finds any of the changes useful, or if there's anything you want to incorporate into your script set.

I broke out the downloading, configuring, and installing into function scripts. I had really mixed results using SDM to download updates, and it was not ideal for clients with limited bandwidth, so I worked out a powershell script to parse the SoftpaqReport.csv and then cross-reference ProductCatalog.xml to extract the download URLs directly and then run a loop to download each with GetLTFile, making it LTCache compatible. My version of the report script puts a condensed, comma-separated list into the EDF and generates an HTML table for the email. I updated the BIOS update script to support hpqflash and incorporate an .HTA based splash screen (based on tlphipps Windows 10 splash here) that takes over the primary screen if the system is logged in. I've only been able to test on an 800G1 so it may need additional tweaks to support other, newer variants.

I also updated my remote monitor powershell this morning with a minor tweak to add some regex checks -- version 4.4.0 on the website dropped the last .0, so I was getting a lot of false positives as the file version is 4.4.0.0 -- the monitor accounts for this now and adds .0 if it's short.

 

 

 

 

 

 

 

HP SDM Scripts.pdf

HP SDM Monitors and Monitor Scripts.pdf

HP SDM Scripts.zip

HP SDM Scripts.zip

Edited by Joe.McCall
3/5/19 -- Updated scripts with improved BIOS update script, support additional models.

Share this post


Link to post
Share on other sites

Just uploaded a new zip file. My report script was referencing the wrong variable name and the function scripts did not take into account the possibility of Automates "OK" script timeout results, so it now checks after each Execute script to see if the variable equals "OK", if it does it re-runs and outputs to a txt file, sleeps the script for a minute, then reads the txt file back into the desired variable.

Share this post


Link to post
Share on other sites

Here's a RAWSQL monitor query to find all machines with SDM installed that have a version less than the highest one in the database.

SELECT DISTINCT 
software.Version AS TestValue, Computers.Name AS IdentityField, computers.computerid, computers.Name,
CONVERT(CONCAT(clients.name,' ',locations.name) USING utf8) AS Location, agentcomputerdata.NoAlerts, agentcomputerdata.UpTimeStart, agentcomputerdata.UpTimeEnd
FROM 
((computers LEFT JOIN Locations ON Locations.LocationID=computers.Locationid) 
	LEFT JOIN Clients ON Clients.ClientID=Computers.clientid 
	LEFT JOIN v_extradatacomputers ON v_extradatacomputers.computerid=computers.computerid
	LEFT JOIN software ON software.computerid=computers.computerid
	JOIN agentcomputerdata ON agentcomputerdata.computerid = computers.computerid) 
WHERE 
software.name='HP Softpaq Download Manager' AND software.version<>(SELECT MAX(VERSION) FROM software WHERE NAME='HP Softpaq Download Manager')

Share this post


Link to post
Share on other sites

Updated the zip, attaching updated script here as well. SSM tries to push BIOS updates if they are found in the folder, so I had a small number of test users who came in this morning to a prompt for BIOS updates unexpectedly. Made a minor tweak to the powershell to have it exclude BIOS updates from the URL list, so BIOS updates will only occur if you run the BIOS update script.

Function - HP SDM - Download All Drivers.xml

Share this post


Link to post
Share on other sites

Thanks for sharing these scripts! 

I am wondering if you have experinced this error message when running Bios and specific driver download scripts. 

"C:\ProgramData\HP\HP SoftPaq Download Manager\SoftPaqReport.csv was not found" 

I can't figure out why it cannot see the csv file in the specified folder. When i use this exact file path it opens the softpaqreport on the computer i test the script on. It always fails on the "IF File Check" when checking the file path, it then tries to create a new softpaqreport.csv but it fails. 

 

 

Share this post


Link to post
Share on other sites
On 5/29/2018 at 12:19 AM, ber said:

Thanks for sharing these scripts! 

I am wondering if you have experinced this error message when running Bios and specific driver download scripts. 

"C:\ProgramData\HP\HP SoftPaq Download Manager\SoftPaqReport.csv was not found" 

I can't figure out why it cannot see the csv file in the specified folder. When i use this exact file path it opens the softpaqreport on the computer i test the script on. It always fails on the "IF File Check" when checking the file path, it then tries to create a new softpaqreport.csv but it fails. 

 

 

Edit "Function - HP SDM - Download Specific Softpaq" -- line 14 label should be :PullURL instead of :PullURLs, or import this fixed version.

Function - HP SDM - Download Specific Softpaq.xml

  • Thanks 1

Share this post


Link to post
Share on other sites

Updated ZIP file attached. Also updated in my original post. I have added some additional logic to a few of the scripts to ensure that the Settings.xml and Default.sdm file are correctly set prior to running the report function. I am also including the internal RAWSQL monitors that I am running.

PDF documents included in the .zip give a breakdown of each monitor and script. Monitors check for pending driver and BIOS updates, missing settings, outdated SDM, or if it has been >30 days since the last driver update check.

 

HP SDM Scripts.zip

Edited by Joe.McCall
6/25 -- Updated with latest scripts

Share this post


Link to post
Share on other sites

We ran into a few cases where the Default.sdm was reset or missing, so it did not pull in the customizations and category selections, which in turn led to garbage like IPM+ and Client Security Manager getting auto-installed, so I have updated these two scripts to include a failsafe in the powershell that builds the reports and generates the URL list to exclude the same categories as the Default.sdm files, just in case.

Function - HP SDM - Download All Drivers.xml

Function - HP SDM - Generate Report.xml

  • Like 1

Share this post


Link to post
Share on other sites

I wonder if HP is moving to replace SoftPaq Download Manager (SDM) with Image Assistant (IA). Check it out!

An HP technician recently informed us that people are moving away from SDM to use IA. I gave it a test and it's far more simple, straight-forward, better documented, and easier to use than SDM. Additionally, it doesn't involve installing any software - it's portable.

Edited by BlueToast

Share this post


Link to post
Share on other sites

Attached an updated version of my BIOS update script. It uses a PowerShell function to locate the BIOS update executable instead of relying on fixed path variables, which will resolve issues with various models that unpack with different folder structures.

HP SDM - BIOS Update.xml

  • Thanks 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×