简体   繁体   中英

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. 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. What I believe the problem was has to do with some of our security settings and possilby kerberos between a 2008

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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