简体   繁体   中英

powershell update-help fails

I just started to learn PowerShell from the Microsoft virtual academy and I was running one of the commands indicated. while on their end it worked mine did not. I did look around for a solution to this issue. I just don't know what went wrong. any tips will helpful for this new PowerShell learner.

PS C:\Windows\system32> Update-Help -Force
Update-Help : Failed to update Help for the module(s) 'WindowsUpdateProvider' with UI culture(s) {en-US} : Unable to retrieve the HelpInfo XML file for UI culture en-US. Make sure the
HelpInfoUri property in the module manifest is valid or check your network connection and then try the command again.
At line:1 char:1
+ Update-Help -Force
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Update-Help], Exception
    + FullyQualifiedErrorId : UnableToRetrieveHelpInfoXml,Microsoft.PowerShell.Commands.UpdateHelpCommand

PS C:\Windows\system32> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.17134.228
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17134.228
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Agreed, that this should be a SuperUser post, but since it is here.

This sort of error common and in most cases expected.

Not all the help files, update as expected for various reasons, most of the time its do to the update link associated. As shown in your error message.

Many module either have no online updateable help or the URL has been removed.

These sorts of error can be safely ignored. They do not impact PS functionality or use.

Get-Module -ListAvailable | Where HelpInfoUri | Update-Help

Or if you want to see all the message going back and forth with this, do...

Update-Help -Force -Verbose -ErrorAction SilentlyContinue

# Results

VERBOSE: Resolving URI: "http://go.microsoft.com/fwlink/?linkid=390758"
VERBOSE: Your connection has been redirected to the following URI: "http://download.microsoft.com/download/0/1/C/01CCC594-2F13-40E8-98FE-185486228BF4/"
VERBOSE: Performing the operation "Update-Help" on target "CimCmdlets, Current Version: 5.0.0.0, Available Version: 5.0.0.0, UICulture: en-US".

If you want to see the full error message in a more human readable for, do this...

Update-Help -Force -Ea 0 -Ev ErrMsgDetail
$ErrorMsgDetail.Exception

Failed to update Help for the module(s) 'AnyBox' with UI culture(s) {en-US} : Unable to connect to Help content. The server on which Help content is stored might not be available. 
Verify that the server is available, or wait until the server is back online, and then try the command again.

Failed to update Help for the module(s) 'HostNetworkingService, WindowsUpdateProvider' with UI culture(s) {en-US} : Unable to retrieve the HelpInfo XML file for UI culture en-US. 
Make sure the HelpInfoUri property in the module manifest is valid or check your network connection and then try the command again.

Actually the problem might also be related to privileges. At least it was for me. On a default Windows 10 install, Update-Help would not work at all, nor did all the other versions with -Force or -ErrorAction .

It turned out, also according to the official online help , you need to be administrator to update the help for powershell <6.0 (which Windows 10 defaults to PS5.1). Starting a new PowerShell with admin privileges immediately removed the problems and I could also view the help as a non-admin.

TL;DR:

Open Powershell, paste the command below and run Update-Help and it should download all AVAILABLE help files:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

It will a give a red warning for the modules that did not have any help files like:

update-help : Failed to update Help for the module(s) 'ConfigDefender, ConfigDefenderPerformance, PSReadline,
WindowsUpdateProvider' with UI culture(s) {en-US} : Unable to retrieve the HelpInfo XML file for UI culture en-US.
Make sure the HelpInfoUri property in the module manifest is valid or check your network connection and then try the
command again.
At line:1 char:1
+ update-help
+ ~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Update-Help], Exception
    + FullyQualifiedErrorId : UnableToRetrieveHelpInfoXml,Microsoft.PowerShell.Commands.UpdateHelpCommand

Long story:

I was trying to find a module and install it:

Find-Module -Name AudioDeviceCmdlets

But it needs NuGet so it prompts to install it but it failed for me:

NuGet provider is required to continue
PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet
 provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or
'$HOME\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by running
'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and import
 the NuGet provider now?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y
WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
WARNING: Unable to download the list of available providers. Check your internet connection.

So I googled for a solution and found out that I need to paste this on Powershell:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

And the NuGet installed just fine, so I remember the issue I had with Update-Help , so I tried it and it worked, and now when I do for example Get-Help Get-Item the help is shown fully.

From Niels Weistra on answers.microsoft:

The solution mentioned above is a workaround, to solve your issue permanently

  1. Open Powershell and check for supported protocols by using [Net.ServicePointManager]::SecurityProtocol

  2. Run the following 2 cmdlets to set .NET Framework strong cryptography registry keys:

Set strong cryptography on 64 bit .Net Framework (version 4 and above):

Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord

Set strong cryptography on 32 bit .Net Framework (version 4 and above):

Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
  1. Restart Powershell and check again for supported protocol by using [Net.ServicePointManager]::SecurityProtocol

Source:

https://answers.microsoft.com/en-us/windows/forum/all/trying-to-install-program-using-powershell-and/4c3ac2b2-ebd4-4b2a-a673-e283827da143

Install NuGet via PowerShell script

I am new to Powershell and found this fixed my problem.

reference link

Update-Help -Verbose -Force -ErrorAction SilentlyContinue

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM