Reputation: 518
According to TechNet one of the keywords for the comment-based help is .Notes
. But when I include this keyword the corresponding help text is not displayed.
My script:
<#
.DESCRIPTION
This describes the script.
.NOTES
This is a note about the script.
#>
"Hello world"
Output of Get-Help:
PS E:\> Get-Help .\Test-Script.ps1
NAME
E:\Test-Script.ps1
SYNOPSIS
SYNTAX
E:\Test-Script.ps1 [<CommonParameters>]
DESCRIPTION
This describes the script.
RELATED LINKS
REMARKS
To see the examples, type: "get-help E:\Test-Script.ps1 -examples".
For more information, type: "get-help E:\Test-Script.ps1 -detailed".
For technical information, type: "get-help E:\Test-Script.ps1 -full".
I know the .Notes keyword is being recognized because if I misspell it, say as ".NotesX", running Get-Help doesn't return any custom help:
PS E:> Get-Help .\Test-Script.ps1
Test-Script.ps1
I looked for a custom switch that Get-Help might require before displaying this section, like the -example
shows the content from the .Example keyword(s), but didn't find one. I'm trying this on PowerShell v5.1.
How can I get the .Notes section to display when Get-Help is run?
Upvotes: 2
Views: 236
Reputation: 519
If you want to see everything, including the .NOTES
section, use Get-Help
's -Full
switch:
Get-Help -Path '.\Test-Script.ps1' -Full
-ShowWindow
switch
If you want Get-Help
to always use -ShowWindow
by default, add this line to your profile.ps1
:
$PSDefaultParameterValues['Get-Help:ShowWindow'] = $true
If you want just the .NOTES section and nothing else, this will output the .NOTES section:
(Get-Help -Path '.\Test-Script.ps1' -Full).alertset.alert.Text
Upvotes: 0
Reputation: 7163
See Get-Help Get-Help
REMARKS
To see the examples, type: "get-help Get-Help -examples".
For more information, type: "get-help Get-Help -detailed".
For technical information, type: "get-help Get-Help -full".
For online help, type: "get-help Get-Help -online"
So you can use:
Get-Help .\Test-Script.ps1 -full
Upvotes: 4