MDT: Running a PowerShell Script During a Deployment

In this tutorial, I will explain how to run a PowerShell script (.ps1 file) during a deployment with MDT.

Copy the ps1 1 file to the Scripts folder in the DeploymentShare folder.

DeploymentShare folder

Open the properties of the task sequence then add a task of type Run Command Line 1.

Move the task to the desired location using the arrows then edit the properties: name the task 1. In the Command line 2 field enter powershell.exe -file "%ScriptRoot%\file-name.ps1". In the Start in 3 field indicate %ScriptRoot% then validate by pressing the Apply button 4 and OK 5.

The next time you deploy with this task sequence, the PowerShell script will be executed.



Related Posts


Jenkins: centralizing the management of scheduled tasks

Jenkins is a free open source software for continuous integration. It is normally used by development equipment to ensure non-regression of source code. In turn, it is possible to use Jenkins as a sch

Active Directory: Joining a Computer to a Domain at the Command Line

Introduction The Active Directory domain join of a computer can be done using either the GUI or using command line and PowerShell. In this tutorial, I will explain how to join a computer to a domain u

Convert an ESD file to WIM

Since the arrival of Windows 10, the image file format on ISO is no longer in WIM format but ESD. In this tutorial, we will see how to convert an ESD to WIM format and then use it on WDS or MDT. 1. Co

Scroll to Top