Const AppName = "Windows NT/2K Autologon" Const RegRoot = "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\" Function ReadValue(ValueName) On Error Resume Next ReadValue = Shell.RegRead(RegRoot & ValueName) On Error GoTo 0 End Function Sub WriteValue(ValueName, Value) On Error Resume Next Shell.RegWrite RegRoot & ValueName, Value On Error GoTo 0 End Sub Sub AutologonIsOff If MsgBox("Autologon is off." & vbNewLine & vbNewLine & _ "Do you want to enable it now?", _ vbYesNo + vbQuestion, AppName) <> vbYes Then Exit Sub Dim Account Account = InputBox("Please enter account in a 'DOMAIN\USER' form." _ & vbNewLine & vbNewLine & "Example: 'MICROSOFT\GATES'", _ AppName, ReadValue("DefaultDomainName") & "\" & _ ReadValue("DefaultUserName")) If Len(Account) = 0 Then MsgBox "Account is not entered.", _ vbOkOnly + vbExclamation, AppName Exit Sub End If Dim I I = InStr(Account, "\") If I = 0 Then I = InStr(Account, "/") If I = 0 Then MsgBox "Invalid account format.", _ vbOkOnly + vbExclamation, AppName Exit Sub End If Dim UserName, Domain UserName = Mid(Account, I + 1) Domain = Left(Account, I - 1) If (Len(UserName) = 0) Or (Len(Domain) = 0) Then MsgBox "Invalid account format.", _ vbOkOnly + vbExclamation, AppName Exit Sub End If Dim Password Password = InputBox("Please enter password for " & Account & _ " account", AppName, ReadValue("DefaultPassword")) WriteValue "AutoAdminLogon", "1" WriteValue "DefaultDomainName", Domain WriteValue "DefaultUserName", UserName WriteValue "DefaultPassword", Password MsgBox "Autologon is enabled now.", _ vbOkOnly + vbInformation, AppName End Sub Sub AutologonIsOn If MsgBox("Autologon is on:" & vbNewLine & vbNewLine & _ "User:" & vbTab & vbTab & _ "'" & ReadValue("DefaultDomainName") & _ "\" & ReadValue("DefaultUserName") & "'" & vbNewLine & _ "Password:" & vbTab & _ "'" & ReadValue("DefaultPassword") & "'" & _ vbNewLine & vbNewLine & _ "Do you want to disable it now?", _ vbYesNo + vbQuestion, AppName) <> vbYes Then Exit Sub WriteValue "AutoAdminLogon", "0" MsgBox "Autologon is disabled now.", _ vbOkOnly + vbInformation, AppName End Sub Dim Shell Set Shell = WScript.CreateObject("WScript.Shell") If ReadValue("AutoAdminLogon") = "1" Then AutologonIsOn Else AutologonIsOff End If Set Shell = Nothing