Automating HP SoftPaq Repository Updates Using PowerShell

A couple of years ago, I moved away from importing drivers into ConfigMgr for our HP laptop and desktop computers. This was accomplished by creating SoftPaq repositories, and applying them during OSD/IPU task sequences using HP System Software Manager. This approach makes for easy replacement of older drivers as there is no importing involved. A future blog post will show that setup.

I previously used HP SoftPaq Download Manager to download SoftPaqs and their corresponding CVA files, of which both are needed to silently install using SSM. Due to a great lifecycle strategy, our environment consists of 7 total unique computer models (4 laptop, 3 desktop). Even with so few models, it was still tedious to maintain the SoftPaq repositories manually. I would need to check if new versions were available, remove old versions, update the SSM database, and update distribution points. Automating that process is much more appealing.

Enter HP Client Management Script Library! In July of 2018, HP introduced a library of PowerShell scripts that can be used to automate this entire process. I am a bit new to PowerShell scripting, but have taken inspiration from others to share my solution. Please share feedback in the comments, as I am sure there are improvements that could be made to my solution below. A couple bloggers that I ‘borrowed’ code from for are Gary Blok (@gwblok) and Ryan Ephgrave (@ephingposh). I also receive excellent help from Nathan Kofahl (@nkofahl) who is with HP. Thanks to you all for your work!

The following script will loop through the models table and do the following:

1. Update an existing repository or create a new repository if one doesn’t exist
2. Setup email alerts to notify of sync failures
3. Invoke a repository sync for bios and driver categories
4. Invoke a repository cleanup to remove old versions
5. Ensure the needed SSM files are up to date
6. Rebuild the SSM database

NOTES:
Running the Script: The script can be run on demand or as a scheduled task. Unless you include the -quiet switch on the Invoke-RepositorySync command, you should see something similar to the following when running the script.

Script running, currently in the Invoke-RepositorySync step for an HP EliteDesk 800 G3 DM 35W

Logging: The logging feature was created by @EphingPosh and is posted at https://www.ephingadmin.com/powershell-cmtrace-log-function/. In my environment, I added this as a separate module, but it could be added to the top of the script as well. This logging is done in CMTrace format for easy readability.

CMTrace formatted script log

Repository Logging: In addition to the script log, HP has a useful repository log called activity.log located in the \.repository subfolder. This shows information about all repository activity (total number of SoftPaqs to be downloaded, what file is currently being downloaded to the repository, etc).

CVA Files: The CVA files that accompany each SoftPaq include the details about what models the SoftPaq is applicable, among other info. These files are frequently updated, so the Invoke-RepositorySync downloads and overwrites these files at every sync. They are very small text files, so this step does not usually increase the script runtime significantly.

SSM Configuration: SSM is a versatile utility. I initially used it as a standalone solution, implemented by a startup script. Configuration of what is needed for both solutions is documented in my Configuring HP SSM blog post. Follow that post, and copy the resulting files for the task sequence section into your ‘SSM Base’ folder, which is located at the root of the repository path.

4 thoughts on “Automating HP SoftPaq Repository Updates Using PowerShell

  1. Nice guide! Thanks 🙂 We use SSM also in our sequence but only for bios updates. The repo you’re making is that on 1 server because we have several remote DP servers so if files must go over WAN that’s tricky.

    Like

    1. The full repository is on one server. Each individual model repository is the data source path for a package in ConfigMgr. That package gets content distributed to DPs, and ConfigMgr distributes updated content as the repositories change.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s