Whenever I run Update-Help, I get tons of errors. I've given up trying to resolve these, it's just how PowerShell works, some help file definitions always fail to update (but if anyone knows how to resolve these I would be interested to try).
So, I want to suppress the errors from my script that updates this stuff every month.
I've tried Update-Help -EA silent
and Update-Help -EA silent | Out-Null
Update-Help -EA silent | Out-Null
but in both cases, the error messages are still sprayed on the screen in red.
Does anyone know hot to suppress these?
Update-Help : Failed to update Help for the module(s) 'AppvClient, ConfigDefender, Defender, HgsClient, HgsDiagnostics,
HostNetworkingService, Microsoft.PowerShell.ODataUtils, Microsoft.PowerShell.Operation.Validation, Sudo, UEV, Whea,
WindowsDeveloperLicense' with UI culture(s) {en-GB} : 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.
At C:\Users\Boss\AppData\Local\Temp\BeginSystemConfig.ps1:571 char:9
+ Update-Help
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Update-Help], Exception
+ FullyQualifiedErrorId : UnableToConnect,Microsoft.PowerShell.Commands.UpdateHelpCommand
Update-Help : Failed to update Help for the module(s) 'WindowsUpdateProvider' with UI culture(s) {en-GB} : Unable to retrieve the
HelpInfo XML file for UI culture en-GB. Make sure the HelpInfoUri property in the module manifest is valid or check your network
connection and then try the command again.
At C:\Users\Boss\AppData\Local\Temp\BeginSystemConfig.ps1:571 char:9
+ Update-Help
+ ~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [Update-Help], Exception
+ FullyQualifiedErrorId : UnableToRetrieveHelpInfoXml,Microsoft.PowerShell.Commands.UpdateHelpCommand
This will help you:
Update-Help -ErrorAction SilentlyContinue
Or
Try {
Update-Help -ErrorAction Stop
# Use this method only if you want to halt script on errors
}
Catch {
# Place action on error here
}
Do not forget that WarningAction exists.
I'm not sure it applies to you, but I was trying to suppress the 'SystemRestorePointCreationFrequency' output of Checkpoint-Computer and it is a Warning--not an Error. The following will suppress that warning:
Checkpoint-Computer -Description "my description" -RestorePointType "MODIFY_SETTINGS" -WarningAction 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.