I am trying to setup my PowerShell command, so the Get-Help -full will show complete information about how to run my script. I have default values that I want to display in this help. I have the following:
<#
.PARAMETER SenderEmail
The name of the user who is sending the email message. Although not
officially required, it will be checked to make sure it's not blank.
#>
Param (
[String]
[Parameter(
Position=1,
HelpMessage="Sender's Email Address")]
$SenderEmail = "bob@fubar.com"
)
Yet, when I type Get-Help -detail, the following shows up.
-SenderEmail <String>
The name of the user who is sending the email message. Although not
officially required, it will be checked to make sure it's not blank.
Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters?
How do I get the help to show the default value of this parameter?
I don’t think you can get the default value to display in an advanced function in V2. I’ve even tried [System.ComponentModel.DefaultValueAttribute(“”)] with no luck. However, if it’s any consolation, this appears to work as-is in V3.