Updating Help Documentation in PowerShell

📜Part of the PowerShell Complete Guide, every PowerShell post on this site, grouped by the job you are doing.

The Update-Help cmdlet downloads the latest help files for your installed modules. In PowerShell 7 it runs without admin rights, because it installs help for the current user by default. In Windows PowerShell 5.1 it needs an elevated session, otherwise you get an access denied error.

PowerShell 7: No Admin Needed

PowerShell
# update help for the current user (the default scope in PowerShell 7)
Update-Help -Scope CurrentUser

-Scope CurrentUser is the default, so plain Update-Help does the same. -Scope AllUsers updates the shared help under $PSHOME, and that one still needs Run as Administrator.

On a current install, expect one error even when everything else works: Failed to update Help for the module(s) 'Microsoft.PowerShell.PSResourceGet, PowerShellGet', saying the HelpInfoUri in the module manifest must resolve to a container or root URL. That comes from those two modules’ manifests, not your permissions, and the rest of the help still updates.

Here it is on my machine. This window happens to be running as administrator, and the same two modules still fail, which shows it is not a permissions problem:

PowerShell 7 in an administrator window: Update-Help -Scope CurrentUser fails only for PSResourceGet and PowerShellGet with the HelpInfoUri error

Windows PowerShell 5.1: Run as Administrator

Windows PowerShell 5.1 has no -Scope parameter (you get A parameter cannot be found that matches parameter name 'Scope'), and its core module help lives under $PSHOME inside C:\Windows\System32. Run Update-Help without admin rights and you get:

Update-Help : Failed to update Help for the module(s) : 'Microsoft.PowerShell.Core'
Access is denied. The command could not update Help topics for the Windows PowerShell core modules, or for any modules in the $pshome\Modules directory. To update these Help topics, start Windows PowerShell by using the "Run as Administrator" command, and try running Update-Help again.

Update-Help Access Denied

To run it as Administrator:

  1. Click Start and search for PowerShell.
  2. Right-click Windows PowerShell and select Run as Administrator.
  3. Confirm the User Account Control (UAC) prompt.
Run PowerShell as Administrator

Using the -Force Parameter

Even as Administrator, Update-Help can report failures for individual modules. A failure like the WindowsUpdateProvider one below means that module publishes no help online. The rest still updates, and -Force will not fix it:

Update-Help -Force Fails

Update-Help also only downloads once every 24 hours. Run it again inside that window and nothing happens; with -Verbose it tells you: Help was not updated for the module Microsoft.PowerShell.Core, because the Update-Help command was run on this computer within the last 24 hours. -Force skips that limit and the version check, so use it to retry straight away:

PowerShell
# retry now, ignoring the once-a-day limit
Update-Help -Force

If the errors mention your UI culture, en-GB for example, add -UICulture en-US. Most help is published in English only.

Update-Help PowerShell

If SQL Server is part of your day job, my current work lives over at sqldba.blog: production DBA scripts, an error library and the SSMS guide.

Comments

Leave a Reply

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