February 2019
Intermediate to advanced
626 pages
15h 51m
English
InitialSessionState objects created using CreateDefault2 will include all of the built-in variables with default values. The value of these variables cannot be changed before the session is opened.
Additional variables can be added using the Add method of the Variables property. Variables are defined as a SessionStateVariableEntry object. An example of adding a variable is shown here:
$variableEntry = [System.Management.Automation.Runspaces.SessionStateVariableEntry]::new( 'Variable', 'Value', 'Optional description')$initialSessionState = [InitialSessionState]::CreateDefault2()$initialSessionState.Variables.Add($variableEntry)
Several overloads are available, each allowing the variable to be defined in greater detail. For ...
Read now
Unlock full access