Skip to content

New-RedactionRule in interactive console prompting for parameter value which is scriptblock #4

@DCAG

Description

@DCAG

When the function New-RedactionRule is typed in interactive console without new value parameter (NewValueFunction or NewValueString) the user is prompted for an input to parameter NewValueFunction which is a [ScriptBlock]. For every given value an error is thrown as this request cannot be fulfilled.

ps> New-RedactionRule -Pattern 'a'

cmdlet New-RedactionRule at command pipeline position 1
Supply values for the following parameters:
NewValueFunction: b
New-RedactionRule : Cannot process argument transformation on parameter 'NewValueFunction'. Cannot convert the "b" value of type "System.String" to type "System.Management.Automation.ScriptBlock".
At line:1 char:1
+ New-RedactionRule -Pattern 'a'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidData: (:) [New-RedactionRule], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,New-RedactionRule

The preferred behavior would be to get a string value instead of [ScriptBlock] which is impossible to provide to a console prompt (to my knowledge).

The reason for the current behavior is that the default parameter set is set to 'Function' and the parameter NewValueFunction is belong to that parameter set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions