Keep Powershell help up to date in the background

PowerShell

Written by:

The help system in Powershell is great. I think its the first thing everyone should master before they jump into Powershell. By default, Powershell ships without the help files, so first you have to update the Powershell help database to unlock its power. Over the time, you will collect more modules and updates, so keeping it up to date is a challenge.

Powershell help no database

Running Get-Help without help files

When you run Powershell in a new computer, and try to use the Get-Help cmdlet, Powershell will ask you if you want to update help first, If you choose not to, the help you will get will be very limited.

To update the help files manually,  just type Update-Help and let Powershell do it thing. The only downside of this command is that you have to wait until it finishes updating all the modules, and the more you have, the longer it will take. Doing it once is OK, but keeping it up to date is time-consuming, and I personally always forget…

Updating Powershell help in the background

We can run the update-help cmdlet and wait, but who loves to wait? Powershell can run jobs in the background, and we can use it to update the help database. To do so, we will use the Start-Job cmdlet:

Now Powershell will update the help files and we can continue to work without waiting for the update to finish. If we want to check if the job is complete, we can use the Get-Job cmdlet:

Automating the process

If you don’t want to deal with the update process, we can add the job to our profile. every time we start a new Powershell session, it will check for updates and preform update if needed. And the best part? it running in the background!

Now go update you help files 😉

Comments are closed.