简体   繁体   English

VBScript:Windows 2008 Server无法自动登录

[英]Vbscript: windows 2008 server fails to autologon

I am doing some automation work that requires several reboots. 我正在做一些需要重新启动的自动化工作。 I am trying to allow my server to auto logon with the admin account. 我试图允许我的服务器使用管理员帐户自动登录。 I can get it working locally, but when I try to do it as a member of the domain it fails. 我可以使它在本地运行,但是当我尝试以域成员的身份进行操作时却失败了。

It appears to me that it is not even trying to perform the logon. 在我看来,它甚至都没有尝试执行登录。 If I put a invalid password into the defaultpassword field (when loging on locally) it will present me with a bad password message, just as if I typed it from the keyboard. 如果我在defaultpassword字段中输入了无效的密码(在本地登录时),它将向我显示错误的密码消息,就像从键盘上键入密码一样。 If I do the same thing to the domain, it does nothing. 如果我对域执行相同的操作,则不会执行任何操作。

Here is the code I am using and have found ref'd on on several different sites and used: 这是我正在使用的代码,已在多个不同站点上找到并使用了这些代码:

'==========================================
'VBScript: enableAutoLogon.vbs            =
'This VBScript updates the registry to    =
'enable auto-logon.  Modify the three     =
'strings in brackets, under "Define       =
'keys and values".                        =
'Courtesy of Jonathan Almquist            =
'monsterjta @ tek-tips                    =
'==========================================
Option Explicit
'''Declarations'''
Dim objShell
Dim RegLocAutoLogon
Dim keyDefaultDomainName
Dim valDefaultDomainName
Dim keyDefaultUserName
Dim valDefaultUserName
Dim keyDisableCAD
Dim valDisableCAD
Dim keyAutoAdminLogon
Dim valAutoAdminLogon
Dim keyForceAutoLogon
Dim valForceAutoLogon
Dim keyDefaultPassword
Dim valDefaultPassword

''''Define keys and values''''
RegLocAutoLogon = "HKLM\Software\Microsoft\" & 
  _"WindowsNT\CurrentVersion\Winlogon\"
keyDefaultDomainName = "DefaultDomainName"
valDefaultDomainName = "[your domain name here]"
keyDefaultUserName = "DefaultUserName"
valDefaultUserName = "[your default user name here]"
keyDisableCAD = "DisableCAD"
valDisableCAD = 1
keyAutoAdminLogon = "AutoAdminLogon"
valAutoAdminLogon = "1"
keyForceAutoLogon = "ForceAutoLogon"
valForceAutoLogon = "1"
keyDefaultPassword = "DefaultPassword"
valDefaultPassword = "[your password here]"

Set objShell = CreateObject("WScript.Shell")
objShell.RegWrite RegLocAutoLogon & _keyDefaultDomainName, 1, "REG_SZ"
objShell.RegWrite RegLocAutoLogon & _keyDefaultDomainName, valDefaultDomainName, "REG_SZ"
objShell.RegWrite RegLocAutoLogon & _keyDefaultUserName, 1, "REG_SZ"
objShell.RegWrite RegLocAutoLogon & _keyDefaultUserName, valDefaultUserName, "REG_SZ"
objShell.RegWrite RegLocAutoLogon & _keyDisableCAD, 1, "REG_DWORD"
objShell.RegWrite RegLocAutoLogon & _keyDisableCAD, valDisableCAD, "REG_DWORD"
objShell.RegWrite RegLocAutoLogon & _keyAutoAdminLogon, 1, "REG_SZ"
objShell.RegWrite RegLocAutoLogon & _keyAutoAdminLogon, valAutoAdminLogon, "REG_SZ"
objShell.RegWrite RegLocAutoLogon & _keyForceAutoLogon, 1, "REG_SZ"
objShell.RegWrite RegLocAutoLogon & _keyForceAutoLogon, valForceAutoLogon, "REG_SZ"
objShell.RegWrite RegLocAutoLogon & _keyDefaultPassword, 1, "REG_SZ"
objShell.RegWrite RegLocAutoLogon & _keyDefaultPassword, valDefaultPassword, "REG_SZ"

This code works fine joining to our 2008 DC. 此代码可以很好地加入我们的2008 DC。 What I believe the problem was has to do with some of our security settings and possilby kerberos between a 2008 我认为问题出在2008年之间,与我们的某些安全设置和possilby kerberos有关

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM