Parameter help is most often written using the .PARAMETER tag, as shown in the following example:
function Get-Something {
<#
.SYNOPSIS
Briefly describes the main action performed by Get-Something
.DESCRIPTION
A detailed description of the activities of Get-Something.
.PARAMETER Parameter1
Describes the purpose of Parameter1.
.PARAMETER Parameter2
Describes the purpose of Parameter2.
#>
param (
$Parameter1,
$Parameter2
)
}
It is also possible to write the help for a parameter above the parameter itself:
function Get-Something {
<#
.SYNOPSIS
Briefly describes the main action performed by Get-Something
.DESCRIPTION
A detailed description of the activities of Get-Something.
#>
param (
# Describes the purpose of Parameter1.
$Parameter1,
# Describes the purpose of Parameter2.
$Parameter2
)
}
One possible advantage of this approach is that it is easy to see which parameters have help and which do not.
Regardless of where help is written for a parameter, Get-Help will read the value:
PS> Get-Help Get-Something -Parameter Parameter1
-Parameter1 <Object>
Describes the purpose of Parameter1.
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false