Powershell脚本默认值未显示在Get-Help -full中

Dav*_* W. 5 parameters powershell

我正在尝试设置PowerShell命令,因此Get-Help -full将会显示有关如何运行脚本的完整信息。我有要在此帮助中显示的默认值。我有以下几点:

<#
    .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"
)
Run Code Online (Sandbox Code Playgroud)

但是,当我键入Get-Help -detail时,将显示以下内容。

-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?
Run Code Online (Sandbox Code Playgroud)

如何获得帮助以显示此参数的默认值?

Kei*_*ill 5

我认为您无法在V2的高级功能中显示默认值。我什至没有运气就尝试过[System.ComponentModel.DefaultValueAttribute(“”)]。但是,如果有什么安慰的话,这似乎可以在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
Run Code Online (Sandbox Code Playgroud)