February 2019
Intermediate to advanced
626 pages
15h 51m
English
The Set variable allows you to change the value and certain aspects of the created variable. For example, the following sets the value of an existing variable:
$objectCount = 23 Set-Variable objectCount -Value 42
It isn't common to see the Set variable being used in this manner; it is simpler to assign the new value directly, as was done when the variable was created. As with the New variable, much of the Set variable's utility comes from the additional parameters it offers, as shown in the following examples.
Setting a description for a variable is effected as follows:
Set-Variable objectCount -Description 'The number of objects in the queue'
Rendering a variable private is effected as follows:
Set-Variable objectCount -Option Private ...
Read now
Unlock full access