How to add an application or script after MDT is complete.

By | December 10, 2011
Share

I ran into a need from a customer to run an application installation that resulted in MDT cleanup scripts to fail. In this event, I figured, the best bet is to perform this installation after the MDT CleanUp process is complete.

1. Remove the portions of LTICleanUp.wsf and Litetouch.wsf scripts that remove the “AdminAutoLogon” values:

LTICleanUp.wsf: (starting at Line 124)

oLogging.CreateEntry "Removing AutoAdminLogon registry entries", LogTypeInfo
On Error Resume Next
'Comment Out the following lines:
'oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon", "0", "REG_SZ"
'oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName", "", "REG_SZ"
'oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName", "", "REG_SZ"
'oShell.RegDelete "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword"
'oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoLogonCount", &H00000000, "REG_DWORD"
On Error Goto 0

Litetouch.wsf changes: (Starting at line 947)

On Error Resume Next
'oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon", "0", "REG_SZ"
On Error Goto 0

2. Next create an application in MDT which calls a batch file, which stages install files on the local disk and calls the files via the “RunOnce” Registry Value or add a Shortcut to the Startup of the Administrator.

Example silent.bat contents:

xcopy "%~dp0*.*" "c:\windows\temp\OpenOffice\" /heyi
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v Path /t REG_SZ /d C:\Windows\Temp\OpenOffice\Install.bat

Install.bat contents:

start /w "" "%~dp0OpenOfficeNinite.exe"
cscript "%~dp0DisableAutoLogonEntries.vbs"

DisableAutoLogonEntries.vbs contents:

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon", "0", "REG_SZ"
objShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName", "", "REG_SZ"
objShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName", "", "REG_SZ"
objShell.RegDelete "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword"
objShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoLogonCount", &H00000000, "REG_DWORD"

/Brian G

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.