Automatically Update PowerShell Help Files

Each time I visit a new co-workers desk (to assist them with something PowerShell related) Get-Help will not return much for them and they asky why. The reason is that they have never ran Update-Help, and by default the help files are not installed on Windows. Help files are also updated so even though you maybe have ran it once, it is important to repeat the process often to keep everything up to date. Here is the procedure to not only update help, but also set a configurable schedule to update your help files. It is of note that the Register-ScheduledJob commandlet used in this example was introduced in PowerShell version 3. Task Scheduler could also be used to execute the schedule.

Step #1: Running PowerShell as an administrator, the following is all you need to do in order to obtain or update all of your help files.

Update-Help

Step #2: The previous example has a prerequisite that the workstation is able to reach the Internet to gain access to the help files. You can bypass this requirement by specifying a local network share. In order to update help from a network share you must first save the help files to that location.

Save-Help -DestinationPath \\server\share\helppath

Step #3: Now that we have saved the help files to our network share, we can update other workstations or users that may not have internet access from that location.

Update-Help -SourcePath \\server\share\helppath

Step #4A: We are now ready to automate the updating of the PowerShell help files. From a workstation/user account with Internet access, the following commands will set up the job. The user assigned in the scheduled job must be an admin of the workstation, have internet access, and a password that doesn’t change. If all your workstations have access to the internet regardless of their user name, a local workstation account instead of a domain account could be used.

$cred = New-Object System.Management.Automation.PsCredential("domain\useraccountwithadminpermissions", (ConvertTo-SecureString "useraccountpassword" -AsPlainText -Force))
Register-ScheduledJob -Name UpdatePowerShellHelpJob -Credential $cred -ScriptBlock {Update-Help} -Trigger (New-JobTrigger -Daily -At "1 AM")

Step #4B: As always, you can also prompt for credentials if you do not want to implement plain text user name and passwords.

$cred = Get-Credential
Register-ScheduledJob -Name UpdatePowerShellHelpJob -Credential $cred -ScriptBlock {Update-Help} -Trigger (New-JobTrigger -Daily -At "1 AM")

Step #4C: If you would like to set the schedule to be weekly instead of daily the following can be used. DaysOfWeek specifies the day(s) of the week that it will run.

$cred = Get-Credential
Register-ScheduledJob -Name UpdatePowerShellHelpJob -Credential $cred -ScriptBlock {Update-Help} -Trigger (New-JobTrigger -Weekly -DaysOfWeek 1 -At "1 AM")

Step #5: If you require the use of a local share to update help when internet access is not available, you can set up the scheduled job with the network source path specified.

$cred = New-Object System.Management.Automation.PsCredential("domain\useraccountwithadminpermissions", (ConvertTo-SecureString "useraccountpassword" -AsPlainText -Force))
Register-ScheduledJob -Name UpdatePowerShellHelpJob -Credential $cred -ScriptBlock {Update-Help -SourcePath \\server\share\helppath} -Trigger (New-JobTrigger -Daily -At "1 AM")

And that covers everything you need to automate the updating of PowerShell Help! Please leave a comment with any questions.

3 Responses

  1. Bryan says:

    Hi Steve,

    I’ve setup something similar : caching update files to a shared folder, but then only update-help from with each of our (admin’s) profile scripts (instead of a scheduled task).

    The issue I had early on was, how to save Help for additional Modules. In my corporate network environment, servers do not have internet access, and client editions of Windows OS do not have copies of Server modules (e.g. RemoteDesktop, ScheduledTasks, ServerCore, ServerManagerTasks). To save these to the DestinationPath, with Save-Help, I first copied the desired modules from a Server (2012 R2 instance, in my case) ($env:SystemRoot\system32\WindowsPowerShell\v1.0\Modules\), first to a network (SMB) share, and then copied and imported them to an internet connected client. Then, I could specify those modules with Save-Help -Module, saving the help content to a network share, where all the servers can access them from.

  1. November 24, 2015

    […] After a two week hiatus I am back this week with a quick write up on how to automate the updating of PowerShell help. Update-Help should be one of the first things typed in PowerShell on a new workstation build. I jump into the topic and demonstrate how to automate the updating of the help files from the Internet or from a local network share. You can view the full article over at PowerShellBlogger.com. […]

Leave a Reply to Bryan Cancel reply

Your email address will not be published. Required fields are marked *