The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,100 other followers

automatic logon in Windows 2003

Posted by jpluimers on 2012/01/27

At a client that still runs Windows Server 2003 (despite the fact that it is in the extended support phase now), I needed to enable automatic logon (one of the tools they run sometimes fails when nobody is logged on).

This was a bit more tricky than just reading [WayBack] How to turn on automatic logon in Windows (now at How to turn on automatic logon in Windows) and following these steps:

To use Registry Editor (Regedt32.exe) to turn on automatic logon, follow these steps:

  1. Click Start, and then click Run.
  2. In the Open box, type Regedt32.exe, and then press ENTER.
  3. Locate the following subkey in the registry:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
  4. Double-click the DefaultUserName entry, type your user name, and then click OK.
  5. Double-click the DefaultPassword entry, type your password, and then click OK.NOTE: If the DefaultPassword value does not exist, it must be added. To add the value, follow these steps:
    1. On the Edit menu, click New, and then point to String Value.
    2. Type DefaultPassword, and then press ENTER.
    3. Double-click DefaultPassword.
    4. In the Edit String dialog, type your password and then click OK.

    NOTE: If no DefaultPassword string is specified, Windows automatically changes the value of the AutoAdminLogon key from 1 (true) to 0 (false), disabling the AutoAdminLogon feature.

  6. On the Edit menu, click New, and then point to String Value.
  7. Type AutoAdminLogon, and then press ENTER.
  8. Double-click AutoAdminLogon.
  9. In the Edit String dialog box, type 1 and then click OK.
  10. Quit Registry Editor.
  11. Click Start, click Shutdown, and then type a reason in the Comment text box.
  12. Click OK to turn off your computer.
  13. Restart your computer. You can now log on automatically.

Since this depends on some registry settings, you need to make sure they are actually set.
And logging on as someone else will reset the DefaultUserName registry setting.

The article points to another article on “AutoAdminLogon looses DefaultUserName” to solve this using REGINI (and optionally REGDMP which can provide sample output for REGINI), but there is a much easier solution using RegEdit which – as Rob van der Woude points out – can be used unattended as well (besides: REGDMP cannot be downloaded any more, and REGINI requires an additional download).

This is how to do force the DefaultUserName to be reset after logon using RegEdit:

  1. Open an explorer Window in “%ALLUSERSPROFILE%\Start Menu\Programs\Startup
  2. Create a batch file “run-RegEdit-DefaultUserName.bat” there with this content:
    regedit /s Administrator-DefaultUserName.bat
  3. Create a text file “Administrator-DefaultUserName.reg” in the same directory with content like this:
    Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
    "DefaultUserName"="Administrator"

Replace “Administrator” with the username you are actually using.

–jeroen

Via: How to turn on automatic logon in Windows.

Updated information from

Use Registry Editor to turn on automatic logon


Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:

322756 How to back up and restore the registry in Windows

To use Registry Editor to turn on automatic logon, follow these steps:

  1. Click Start, and then click Run.
  2. In the Open box, type Regedt32.exe, and then press Enter.
  3. Locate the following subkey in the registry:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
  4. Double-click the DefaultUserName entry, type your user name, and then click OK.
  5. Double-click the DefaultPassword entry, type your password, and then click OK.Note If the DefaultPassword value does not exist, it must be added. To add the value, follow these steps:
    1. On the Edit menu, click New, and then point to String Value.
    2. Type DefaultPassword, and then press Enter.
    3. Double-click DefaultPassword.
    4. In the Edit String dialog, type your password and then click OK.

    Note If no DefaultPassword string is specified, Windows automatically changes the value of the AutoAdminLogon key from 1 (true) to 0 (false), disabling the AutoAdminLogon feature.

  6. On the Edit menu, click New, and then point to String Value.
  7. Type AutoAdminLogon, and then press Enter.
  8. Double-click AutoAdminLogon.
  9. In the Edit String dialog box, type 1 and then click OK.
  10. If you have joined the computer to a domain, you should add the DefaultDomain value, and the data for the value should be set as the fully qualified domain name (FQDN) of the domain.
  11. Exit Registry Editor.
  12. Click Start, click Shutdown, and then type a reason in the Comment text box.
  13. Click OK to turn off your computer.
  14. Restart your computer. You can now log on automatically.

Notes

  • To bypass the AutoAdminLogon process and to log on as a different user, press and hold the Shift key after you log off or after Windows restarts.
  • This registry change does not work if the Logon Banner value is defined on the server either by a Group Policy object (GPO) or by a local policy. When the policy is changed so that it does not affect the computer, the autologon feature works as expected.
  • When Exchange Active Sync (EAS) password restrictions are active, the autologon feature does not work. This behavior is by design. This behavior is caused by a change in Windows 8.1 and does not affect Windows 8 or earlier versions. To work around this behavior in Windows 8.1 and later versions, remove the EAS policies in Control Panel.
  • An interactive console logon that has a different user on the server changes the DefaultUserName registry entry as the last logged-on user indicator. AutoAdminLogon relies on the DefaultUserName entry to match the user and password. Therefore, AutoAdminLogon may fail. You can configure a shutdown script to set the correct DefaultUserName.
  • You can use the Sysinternals tool AutoLogon to enable this functionality easier. This tool also helps you to use an encrypted version of password.

2 Responses to “automatic logon in Windows 2003”

  1. Rich Shealer said

    Why did you call the data file Administrator-DefaultUserName.bat rather than Administrator-DefaultUserName.reg?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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

 
%d bloggers like this: