New-DynamicParamDictionary¶
SYNOPSIS¶
Creates a new RuntimeDefinedParameterDictionary
SYNTAX¶
New-DynamicParamDictionary [[-ParameterDefinition] <Object>] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
DESCRIPTION¶
Creates a new RuntimeDefinedParameterDictionary
EXAMPLES¶
EXAMPLE 1¶
New-DynamicParamDictionary
Returns a new RuntimeDefinedParameterDictionary
EXAMPLE 2¶
New-DynamicParamDictionary -ParameterDefinition $param1, $param2
Outputs:
Key Value
--- -----
Variable System.Management.Automation.RuntimeDefinedParameter
EnvironmentVariable System.Management.Automation.RuntimeDefinedParameter
Returns a new RuntimeDefinedParameterDictionary with the specified parameters.
EXAMPLE 3¶
DynamicParams @(
@{
Name = 'Variable'
Type = [string]
ValidateSet = Get-Variable | Select-Object -ExpandProperty Name
},
@{
Name = 'EnvironmentVariable'
Type = [string]
ValidateSet = Get-ChildItem -Path env: | Select-Object -ExpandProperty Name
}
)
Outputs:
Key Value
--- -----
Variable System.Management.Automation.RuntimeDefinedParameter
EnvironmentVariable System.Management.Automation.RuntimeDefinedParameter
Returns a new RuntimeDefinedParameterDictionary with the specified parameters.
EXAMPLE 4¶
$params = @(
@{
Name = 'Variable'
Type = [string]
ValidateSet = Get-Variable | Select-Object -ExpandProperty Name
},
@{
Name = 'EnvironmentVariable'
Type = [string]
ValidateSet = Get-ChildItem -Path env: | Select-Object -ExpandProperty Name
}
)
$params | ForEach-Object { New-DynamicParam @_ } | New-DynamicParamDictionary
Outputs:
Key Value
--- -----
Variable System.Management.Automation.RuntimeDefinedParameter
EnvironmentVariable System.Management.Automation.RuntimeDefinedParameter
Returns a new RuntimeDefinedParameterDictionary with the specified parameters.
PARAMETERS¶
-ParameterDefinition¶
An array of hashtables or RuntimeDefinedParameter objects to add to the dictionary.
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-ProgressAction¶
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters¶
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS¶
OUTPUTS¶
System.Management.Automation.RuntimeDefinedParameterDictionary¶
NOTES¶
RELATED LINKS¶
https://psmodule.io/DynamicParams/Functions/New-DynamicParamDictionary/