Create your own MDT FinishAction

In this post, I will show a quick tip that allows you to create your own finish action, in order to execute a specific action after clicking on the Finish button or at the end of the deployment.

In MDT a variable called FinishAction allows you to do a specific action when deployment is finished. 
This action is done once you click on the Finish button or when the deployment is finished.
By default there are three actions available:
- Reboot or restart
- Logoff
- Shutdown
So why not creating a new one ?

What do I want ? 
Once the deployment is completed, I want to run the below actions:
- Create a folder C:\OSD_Logs
- Copy deployment logs in C:\OSD_Logs
- Copy DISM, panther ligs in C:\OSD_Logs\System
- Create system and applications evtx and copy them in OSD_Logs
- Reboot the computer
See below the PowerShell script I will use to do that. I named it SD_Reboot_Actions.ps1 and copied it in Scripts folder.

What to modify ?
1 / Open the file Litetouch.wsf
2 / Search the part Sub Reboot, by default as below:
3 / Copy it and rename it as, Sub Reboot_Custom, as below:
4 / Then call the PowerShell script in the Reboot_Custom as below:
5 / Now we have to choose a value for our custom FinishAction. This way we can call it from the customsettings.ini file or TS.
6 / In Litetouch.wsf search "Select Case UCase(sFinishAction)", by default as below:
7 / Choose a value to use, in my case MY_REBOOT and call your custom reboot action, as below:
8 / Now to use this new FinishAction, you will need to use it with the new created value for instance in the customsettings.ini, FinishAction=MY_REBOOT or in a Task Sequence step.

Share this

Related Posts

Next Post »