r/PowerShell • u/xXFl1ppyXx • May 18 '26
Question Get-Help Informations missing
I'm in the middle of decorating some older functions with HelpMessages / Get-Help Infos. Somehow i can't get the output to work without adding "junk information". Specifically Aliases, Parameter-Sets and Default Values:
This Function:
function Test-FunctionHelp {
<#
.SYNOPSIS
.DESCRIPTION
.PARAMETER TestParameter
.EXAMPLE
Test-FunctionHelp -TestParameter "Parameter"
#>
[CmdletBinding()]
[Alias('tfh')]
param (
[Parameter()]
[Alias('ParameterAlias')]
[string]$TestParameter
)
}
Get-Help "Test-FunctionHelp" -FullOutputs this Help:
NAME
Test-FunctionHelp
SYNOPSIS
SYNTAX
Test-FunctionHelp [[-TestParameter] <String>] [<CommonParameters>]
DESCRIPTION
PARAMETERS
-TestParameter <String>
Required? false
Position? 1
Default value
Accept pipeline input? false
Aliases
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS > Test-FunctionHelp -TestParameter "Parameter"
RELATED LINKSWhile adding junk at the last part of of the Help Block like this:
function Test-FunctionHelp {
<#
.SYNOPSIS
.DESCRIPTION
.PARAMETER TestParameter
.EXAMPLE
Test-FunctionHelp -TestParameter "Parameter"
.A
#>
[CmdletBinding()]
[Alias('tfh')]
param (
[Parameter()]
[Alias('ParameterAlias')]
[string]$TestParameter
)
}
Get-Help "Test-FunctionHelp" -FullOutputs the expected Helpmessage:
NAME
Test-FunctionHelp
SYNTAX
Test-FunctionHelp [[-TestParameter] <string>] [<CommonParameters>]
PARAMETERS
-TestParameter <string>
Required? false
Position? 0
Accept pipeline input? false
Parameter set name (All)
Aliases ParameterAlias
Dynamic? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
None
OUTPUTS
System.Object
-------------------------- EXAMPLE 1 --------------------------
PS > Test-FunctionHelp -TestParameter "Parameter"
ALIASES
tfh
REMARKS
NoneIs there anything i'm missing? It's not that big of a deal but i'm wondering why some things are not picked up properly without adding some junk into the Help-Block. Am i missing something particulary important in the help block?
Btw it doesn't matter at what point i add the "junk"
all of those examples work as intended:
<#
.SYNOPSIS
.DESCRIPTION
.PARAMETER TestParameter
.EXAMPLE
Test-FunctionHelp -TestParameter "Parameter"
.A
#>
<#
.A
.SYNOPSIS
.DESCRIPTION
.PARAMETER TestParameter
.EXAMPLE
Test-FunctionHelp -TestParameter "Parameter"
#>
<#
.SYNOPSIS
.DESCRIPTION
.PARAMETER TestParameter
.EXAMPLE
.A
Test-FunctionHelp -TestParameter "Parameter"
#>
View all comments
Show parent comment
1
u/odwulf May 19 '26
I've never seen any preference in the Comment Based Help documentation about where it's better. Not in the 5.1 version, nor in the later ones. It lists the different possibilities, a couple of additional conditions when used on a script rather than a function (the double empty line when put at the start, the incompatibility with signatures), but there is no, and as far as I remember it, there never was, anything about one location being better than an other.
I've got 15 years behind me of putting it at the top of hundreds if not thousands of functions, and never, ever, had any problem with it, whatever the version of Powershell.