Know how updatable help works in PowerShell – HelpUri and HelpInfoUri

PowerShell has two ways of using updatable help: HelpUri and HelpInfoUri. Both of these sounds same but they are actually much different. If you ever happen to write some serious PowerShell scripts, you may end up confusing them and it might result in that help won’t work as actually intended.

HelpUri: The URI in the value of the HelpUri property is the online location of the Help topic for the cmdlet in reference. It can be obtained using that or it can also be obtained using relatedlinks property in the help file. For example:

PS C:\Windows\system32> (Get-Command Get-History).HelpUri
http://go.microsoft.com/fwlink/?LinkID=113317

or

PS C:\Windows\system32> (Get-help Get-History).relatedlinks

Online Version: http://go.microsoft.com/fwlink/?LinkID=113317

Get-Help -Online gets the HelpUri URL value from two sources. If both are present, the value in the help file takes precedence. The important point is that it should be web page which is browsable. Why two values? It’s because Microsoft wanted online Help to work even when the Help files were not installed on the local machine—so they couldn’t rely on a value in a local Help file and added the HelpUri attribute to the cmdlet (and function, CIM command, and workflow) script.

HelpInfoUri: The HelpInfoUri property of modules enables updatable help for a module. The property value is the URL of the online location of the HelpInfo XML file that configures updatable help for the module. The updatable help CAB files can be stored in the same URL location (or any online location specified by the HelpContentUri element in the HelpInfo XML file), but the HelpInfoUri URL always points to the HelpInfo XML file. Unlike the HelpInfo property value, you can’t browse to the HelpInfoUri location, because it links to an XML file, not a web page.

It can be obtained in a module manifest of a module:

PS C:\Windows\system32> cat (get-module -list Microsoft.PowerShell.Security).Path
@{
GUID="A94C8C7E-9810-47C0-B8AF-65089C13A35A"
Author="Microsoft Corporation"
CompanyName="Microsoft Corporation"
Copyright="© Microsoft Corporation. All rights reserved."
ModuleVersion="3.0.0.0"
PowerShellVersion="3.0"
CLRVersion="4.0"
CmdletsToExport="Get-Acl", "Set-Acl", "Get-PfxCertificate", "Get-Credential", "Get-ExecutionPolicy", "Set-ExecutionPoli
cy", "Get-AuthenticodeSignature", "Set-AuthenticodeSignature", "ConvertFrom-SecureString", "ConvertTo-SecureString"
NestedModules="Microsoft.PowerShell.Security.dll"
HelpInfoURI = 'http://go.microsoft.com/fwlink/?LinkID=210602'
}

The HelpInfo.xml file is like an old-fashioned .inf file. More important point is that you cannot browse a location for helpinfouri.

I hope this clarifies how updatable help works in PowerShell. If you are writing a module for your own product, try to follow the same guidelines.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s