Share via


Setting Default Domain Name in Operating System Deployment

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.

    image  image

The standard way of doing this is to change the registry keys under HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon, namely:

Value Data
DefaultDomainName Domain Name
AltDefaultDomainName Domain Name
DefaultUserName Blank
AltDefaultUserName Blank

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.

image

Note: My test domain here is SMALLBLUEPLANET

Warning!   Information at https://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"

Disclaimer: The information on this site is provided "AS IS" with no warranties, confers no rights, and is not supported by the authors or Microsoft Corporation. Use of included script samples are subject to the terms specified in the Terms of Use .

This post was contributed by Ian Dearing, a Dedicated Supportability Engineer with Microsoft Premier Field Engineering, UK.

Comments

  • Anonymous
    December 29, 2009
    Thanks for this post.  It is something I have definitely been looking into.  However, I am still seeing issues even after adding the CachePrimaryDomain entry along with the others you list above. Everything works fine for the first boot after the task sequence is complete.  But if the user is logged off or the machine is rebooted, the DefaultDomainName value is set back to the machine name(I have verified this is set immediately after initial logon). AltDefaultDomainName and PrimaryCacheDomain are still set to the correct domain. I am about to just fix this with GPOs, but wanted to see if you have any other suggestions.

  • Anonymous
    January 20, 2010
    I've tried all the settings you suggest above, but I still have to fix the domain name after the first reboot post tasksequence completion.  Any ideas?