Powershell Script Default Value not showing up in Get-Help -full

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?

Answers


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.

V3 ONLY!!
PS> Get-Help .\help.ps1 -full

NAME
    C:\temp\help.ps1

SYNOPSIS

SYNTAX
    C:\temp\help.ps1 [[-SenderEmail] <String>] [<CommonParameters>]


DESCRIPTION


PARAMETERS
    -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                bob@fubar.com
        Accept pipeline input?       false
        Accept wildcard characters?  false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, see 
        about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 

INPUTS

OUTPUTS


RELATED LINKS

There does not seem to be a way to specify the default value for a parameter. You need to specify it in the parameter's description.

<#
.PARAMETER SenderEmail
The name of the user who is sending the email message. If not 
specified, a default value of bob@fubar.com will be used
#>

This post has information in the trouble shooting section http://technet.microsoft.com/en-us/library/dd819489.aspx.

Default values and a value for "Accept Wildcard characters" do not appear in
the parameter attribute table even when they are defined in the function or
script. To help users, provide this information in the parameter description.

Seem's to be fixed in the next revision as noted by @KeithHill


Need Your Help

What exactly happens when you run mvn install?

java maven intellij-idea

I know that when you run mvn install it will compile, package, and copy the binaries in the local .m2 repository.

How can I pull in the Rails action or controller names into my Ruby Gem for use in a log file?

ruby-on-rails ruby gem

First question on here so go easy please. I am writing a gem for use in my rails application. The gem will simply print to a log file the information passed via the params from an action in the