|Microsoft Deployment Toolkit
Include Prerequisites for Running Windows PowerShell Scripts in MDT
When a Run PowerShell Script task sequence step runs a Windows PowerShell script, the step automatically loads the Microsoft.BDD.TaskSequenceModule module prior to running the script. The Microsoft.BDD.TaskSequenceModule module is responsible for creating the TSENV: and TSENVLIST: Windows PowerShell drives.
In addition, it is recommended that your script load the ZTIUtility.psm1 module at the beginning of your script by adding the following line to the beginning of your script:
Including the ZTIUtility.psm1 module at the beginning of your script provides the following features:
· Creates the TSENV: and TSENVLIST: Windows PowerShell drives so that you can test your script outside a task sequence
· Provides support for Windows PowerShell task sequence module features that may be provided in future releases
For more information on the TSENV: and TSENVLIST: Windows PowerShell drives, see Use Task Sequence Variables Within Windows PowerShell Scripts.
Note For Configuration Manager 2012 and Configuration Manager 2007 R3 task sequences, run the Use Toolkit Package task sequence step prior to running the Run PowerShell Script task sequence step.
If your script needs to load other custom modules, places those modules in a subfolder beneath the Tools\Modules folder. By default, the module path is modified to include the Tools\Modules folder and all subfolders. For example, if you have a module in the MyCustomModule.psm1 file, create the Tools\Modules\MyCustomModule folder and the place MyCustomModule.psm1 file in that folder. To load your custom module in your script, include the following line in in your script: