Some times you want to execute a script after the MDT 2013 Task Sequence is completed, for example to cleanup any setup leftovers or to configure a user for autologon (something that MDT by default prevents).
Note: This also works in later MDT versions.
This script will clean out any leftover C:\MININT or C:\_SMSTaskSequence folders, enable (optional) autologon with another user account, disable setup wizard for Microsoft Security Essentials (if added to the reference image) and then do a proper final reboot…
Note: For the script to work, you need to set SkipFinalSummary=YES in CustomSettings.ini (the script will check for it)
Add the script to Deployment Workbench
Adding the script is quite straightforward, just add it as an application and then call the app as your last action in the Task Sequence. In this example my MDT server is named MDT01, and my deployment share is named MDT production. For these steps I assume you have downloaded the script and extracted it to D:\Setup\Final Configuration 2013.
- Using the Deployment Workbench, in the MDT Production node, select the Applications node, and create a folder named ViaMonstra.
- Expand the Applications node, right-click the ViaMonstra folder, and select New Application, Use the following settings for the New Application Wizard.
- Application with source files
- Application name: Final Configuration for MDT 2013
- Source Directory: D:\Setup\Final Configuration 2013
- Specify the name of the directory that should be created: Final Configuration for MDT 2013
- Command Line: cscript.exe Configure-FinalConfig.wsf
- Working directory:
Configure the task sequence to use the script
After the application is added you simply add the application as your last action in the Task Sequence. In this example I'm adding the script to my Windows 8.1 Enterprise x64 task sequence which I created in a folder (node) named Windows 8.1.
- Using the Deployment Workbench, in the MDT Production node, select the Task Sequences / Windows 8.1 node
- Right-click the Windows 8.1 Enterprise x64 task sequence, and select Properties.
- After the last action in the task sequence, add a new Install Application action with the following settings:
- Name: Final Configuration for MDT 2013
- Install a Single Application: Final Configuration for MDT 2013
- Click OK.
Optional configuration, enabling autologon for another user account
If you want to enable another user for autologon, simply uncomment lines 113-120 in the FinalConfig.hta file, and change the user/domain and password. If you want to logon with a local user, set domain to "." Here is an example for a normal domain account.
StatusArea.InnerHTML=StatusArea.InnerHTML & "<BR>" & "Enable autologon for another user account." oShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon", 1, "REG_SZ" oShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoLogonCount", 999, "REG_SZ" oShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName", "Johan", "REG_SZ" oShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName", "VIAMONSTRA", "REG_SZ" oShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword", "[email protected]", "REG_SZ" oShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\ForceAutoLogon", 1, "REG_SZ" oShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DisableCAD", 1, "REG_DWORD"
Happy Deployment! / Johan