MDT supports running Windows PowerShell scripts as a part of the deployment process. You can develop Windows PowerShell scripts to help automate the deployment process and then run those scripts within an MDT task sequence.

Run the Windows PowerShell scripts using a task sequence step created using the Run PowerShell Script task sequence step type. You can add a task sequence step based on the Run PowerShell Script task sequence step type for task sequences in LTI, ZTI, or UDI.

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.

To run a Windows PowerShell script in a task sequence

1.   Create the Windows PowerShell script.

For more information about creating Windows PowerShell scripts for use in MDT task sequences, see Create Windows PowerShell Scripts for Use in MDT.

2.   Place the Windows PowerShell script in the Scripts subfolder in the:

·     Deployment share for LTI

·     MDT files package for ZTI and UDI

3.   Add a new task sequence step to your task sequence based on the Run PowerShell Script task sequence step type.

4.   In the newly create task sequence step, in the PowerShell script text box, script_name (where script_name is the fully qualified path to the Windows PowerShell script).

If you specify:

·     Just the script name, then the assumption is that the script exists in the Scripts subfolder

·     A fully qualified path and script name, then ensure that the task sequence has access to the folder in which the script is stored (For example, if the script is stored on a network shared folder, ensure that there is an existing connection to that server prior to running the script.)

Related Topics

Configuring MDT Deployments