Partager via


PowerShellValue<T>.ValidateExpressionConstraints Method

Definition

Check to see if the expression only uses elements of the restricted language as well as only using the allowed commands and variables.

public:
 void ValidateExpressionConstraints(System::Collections::Generic::IEnumerable<System::String ^> ^ allowedCommands, System::Collections::Generic::IEnumerable<System::String ^> ^ allowedVariables, bool allowEnvironmentVariables);
public void ValidateExpressionConstraints (System.Collections.Generic.IEnumerable<string> allowedCommands, System.Collections.Generic.IEnumerable<string> allowedVariables, bool allowEnvironmentVariables);
member this.ValidateExpressionConstraints : seq<string> * seq<string> * bool -> unit
Public Sub ValidateExpressionConstraints (allowedCommands As IEnumerable(Of String), allowedVariables As IEnumerable(Of String), allowEnvironmentVariables As Boolean)

Parameters

allowedCommands
IEnumerable<String>

List of command names to allow in the expression

allowedVariables
IEnumerable<String>

List of variable names to allow in the expression. If the collection contains a single element "*", all variables will be allowed including environment variables functions, etc.

allowEnvironmentVariables
Boolean

If true, environment variables are allowed even if the allowedVariables list is empty.

Applies to