windows 如何自动登录Windows帐户?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6268214/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 17:00:44  来源:igfitidea点击:

How to auto login to windows account?

windowswindows-serviceswindows-server-2008

提问by chobo

I am researching ways to auto login to a windows server, so applications can be restarted on reboot if the server crashes. Do windows services load before or after a user logs in? Can a windows service be used to login to an account?

我正在研究自动登录到 Windows 服务器的方法,因此如果服务器崩溃,应用程序可以在重新启动时重新启动。Windows 服务是在用户登录之前还是之后加载?可以使用Windows服务登录帐户吗?

If not, is there any way to use some sort of login script to facilitate automatically loggin in?

如果没有,有什么方法可以使用某种登录脚本来促进自动登录?

回答by Yeo

For auto login. Here is one of them:

用于自动登录。这是其中之一:

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

要使用注册表编辑器 (Regedt32.exe) 打开自动登录,请按照下列步骤操作:

  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.
  1. 单击开始,然后单击运行。
  2. 在打开框中,键入 Regedt32.exe,然后按 Enter。
  3. 在注册表中找到以下子项:
    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
  4. 双击 DefaultUserName 条目,键入您的用户名,然后单击确定。
  5. 双击 DefaultPassword 条目,键入您的密码,然后单击 OK。注意:如果 DefaultPassword 值不存在,则必须添加它。要添加值,请执行以下步骤:

    1. 在编辑菜单上,单击新建,然后指向字符串值。
    2. 键入 DefaultPassword,然后按 Enter。
    3. 双击默认密码。
    4. 在“编辑字符串”对话框中,键入您的密码,然后单击“确定”。
      • 注意:如果未指定 DefaultPassword 字符串,Windows 会自动将 AutoAdminLogon 键的值从 1 (true) 更改为 0 (false),从而禁用 AutoAdminLogon 功能。
  6. 在编辑菜单上,单击新建,然后指向字符串值。

  7. 键入 AutoAdminLogon,然后按 Enter。
  8. 双击 AutoAdminLogon。
  9. 在“编辑字符串”对话框中,键入 1,然后单击“确定”。
  10. 退出注册表编辑器。
  11. 单击开始,单击关机,然后在注释文本框中键入原因。
  12. 单击“确定”关闭计算机。
  13. 重启你的电脑。您现在可以自动登录。

Taken from: http://support.microsoft.com/kb/324737

取自:http: //support.microsoft.com/kb/324737

回答by AntonyW

Services run regardless of whether a user logs on. If you need an application to run all the time, have you considered converting it to a service? Auto-logon is a security risk.

无论用户是否登录,服务都会运行。如果您需要一个应用程序一直运行,您是否考虑过将其转换为服务?自动登录存在安全风险。

回答by FreshITauto

I have tested it on:

我已经对它进行了测试:

  • WIN10 updated Jan-2016
  • WIN7 updated Jan-2016
  • WIN10 更新 2016 年 1 月
  • WIN7 更新 2016 年 1 月

And it works!

它有效!

I use this .REG file:

我使用这个 .REG 文件:

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"AutoAdminLogon"="1"
"DefaultDomainName"="DOMAINNAME"
"DefaultUserName"="USERNAME"
"DefaultPassword"="PASSWORD"

Extracted from: http://www.sysadmit.com/2016/01/windows-configurar-autologin.html

摘自:http: //www.sysadmit.com/2016/01/windows-configurar-autologin.html

回答by Mike Soule

Windows Services do load before user logins. A Windows service cannot be used to login to an account, but you can specify the account to run the service under. You can setup automatic login in the registry under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon.
AutoAdminLogon, DefaultUserName, DefaultPassword, DefaultDomainName, and ForceAutoLogon are the keys you will need to set. They are all strings.

P.S. This is more a Server Fault \ Super User question.

Windows 服务会在用户登录之前加载。Windows 服务不能用于登录帐户,但您可以指定运行该服务的帐户。您可以在注册表中的 HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon 下设置自动登录。
AutoAdminLogon、DefaultUserName、DefaultPassword、DefaultDomainName 和 ForceAutoLogon 是您需要设置的键。它们都是字符串。

PS 这更像是一个服务器故障\超级用户问题。

回答by Sysyphus

Services start before login. And rather than using a service to log into an account, why not just set the account to auto log in? http://www.expta.com/2008/03/how-to-enable-autologon-in-windows.html.

服务在登录前启动。与其使用服务登录帐户,不如将帐户设置为自动登录? http://www.expta.com/2008/03/how-to-enable-autologon-in-windows.html

*edit*Beaten to it*

*编辑*被打败了*

回答by Roman

Maybe systinternals/autologon.exeshould be mentioned here.
It has a very simple gui and can also be used by command line only.
I guess it does the registry entry in the background.

也许这里应该提到systinternals/autologon.exe
它有一个非常简单的 gui,也可以仅通过命令行使用。
我猜它在后台执行注册表项。