In Configuration Manager Operating System Deployment, it is desirable to change the default logon to the domain the computer is joined to, from the default which is the local computer.
The standard way of doing this is to change the registry keys under HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon, namely:
This will normally work, but fails for Operating System Deployments. This is because with Task Sequences in OSD we replace the GINA (the Graphical Identification and Authentication, i.e. the Ctrl+Alt+Delete prompt) so we can run a task sequence whilst deploying. This is configured under HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\GINA. It appears that when changing back to the normal GINA by removing this entry, the DefaultDomainName entry is removed.
The workaround for this is to also populate the CachePrimaryDomain registry string value under the Winlogon key.
Note: My test domain here is SMALLBLUEPLANET
Warning! Information at http://technet.microsoft.com/en-us/library/cc782904(WS.10).aspx states that this entry is no longer used and should not be modified. Changing this value should be tested carefully in your environment to ensure that it does not cause any unexpected results.
This has been tested on Windows XP and Windows Server 2003 and worked perfectly.
The following script should set the default domain. This is example code only: error checking, generalisation and logging have been removed for simplification.
Const WinLogon = "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\"
Set oShell = CreateObject("WScript.Shell")
oShell.RegWrite WinLogon & "DefaultUserName","", "REG_SZ"
oShell.RegWrite WinLogon & "AltDefaultUserName","", "REG_SZ"
oShell.RegWrite WinLogon & "AltDefaultDomainName", "SMALLBLUEPLANET", "REG_SZ"
oShell.RegWrite WinLogon & "DefaultDomainName", "SMALLBLUEPLANET", "REG_SZ"
oShell.RegWrite WinLogon & "CachePrimaryDomain", "SMALLBLUEPLANET", "REG_SZ"
This post was contributed by Ian Dearing, a Dedicated Supportability Engineer with Microsoft Premier Field Engineering, UK.