Using Task Sequence variables in a PowerShell script

Hi Again,

In my last entry I posted a script that uses the following line of code:

Running the above code during the build process (i.e. inside the Task Sequence) lets me interact with any Task Sequence variable. I can obtain the value of any variable in the Task Sequence by running $TSEnv.Value(“VariableName”) – for example:

This also works for custom variables:

We can also set the value of a variable by using the same method – adding =”value” at the end. For example:

In our environment we’ve used this for a range of things, combined with an MDT Web Service the possibilities are endless!

Leave a Reply

Your email address will not be published. Required fields are marked *