Please feel free to provide feedback or file bugs here.

Add DefaultValue property to System.Management.Automation.CommandParameterInfo class

Votes from Connect: 8

Original Date Submitted: 3/3/2015 5:52:55 AM

********Contact Information********
Handle: June Blender
Site Name: PowerShell
Feedback ID: 1157696

Frequency: Always Happens
Regression: Yes, this happens in all previous versions

Problem Description:
Currently, there is no way to detect whether a command parameter has a default value or what the default value is. It's important to help authoring and to command parsing.

I can use the AST to get the default value, but that works only for functions and scripts; not for cmdlets.

Product Studio item created by Connect Synchronizer due to creation of feedback ID 1157696 (

Repro Steps:
(gcm <command>).ParameterSets.Parameters | gm

Expected Results:
TypeName: System.Management.Automation.CommandParameterInfo

Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Aliases Property System.Collections.ObjectModel.ReadOnlyCollection[string] Aliases {get;}
Attributes Property System.Collections.ObjectModel.ReadOnlyCollection[System.Attribute] Attributes {get;}
DefaultValue Property string DefaultValue {get;}
HelpMessage Property string HelpMessage {get;}
IsDynamic Property bool IsDynamic {get;}
IsMandatory Property bool IsMandatory {get;}
Name Property string Name {get;}
ParameterType Property type ParameterType {get;}
Position Property int Position {get;}
ValueFromPipeline Property bool ValueFromPipeline {get;}
ValueFromPipelineByPropertyName Property bool ValueFromPipelineByPropertyName {get;}
ValueFromRemainingArguments Property bool ValueFromRemainingArguments {get;}

Internal BugId: 14277

1 vote
Sign in
Sign in with: Facebook Google
Signed in as (Sign out)

We’ll send you updates on this idea

AdminJoey Aiello [MSFT] (Program Manager, Windows Server) shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Sign in with: Facebook Google
Signed in as (Sign out)

Feedback and Knowledge Base