Using Online Help (Part 2)

by Oct 9, 2020

In the previous tip we mentioned that many PowerShell users prefer the online help over locally downloaded help. To use the online help documents by default, try this in a fresh PowerShell console:

# by default, -? opens LOCAL help
PS> dir -?

    Gets the items and child items in one or more specified locations.

# with this line you tell PowerShell to use the ONLINE help by default
PS> $PSDefaultParameterValues.Add("Get-Help:Online",$true)

# now, whenever you use -?, the ONLINE help opens in a nicely formatted browser window
PS> dir -? 

With the $PSDefaultParameterValues.Add("Get-Help:Online",$true) command you tell PowerShell that the Get-Help command should always automatically use the -Online parameter, so now you always get browser-based help.

While this is great in most scenarios, online help cannot automatically display about topics. If you need to show about topics, simply use Get-Help or help with the -ShowWindow parameter to display local help:

# this fails when help defaults to show ONLINE help
PS> help about_for
Get-Help : The online version of this Help topic cannot be displayed because the Internet address (URI) of the Help topic is not specified in the command code or in the help file for the command.

# the -ShowWindow parameter always shows local help in an extra window
PS C:\> help about_for -ShowWindow  

Twitter This Tip! ReTweet this Tip!