http://dieseyer.de • all rights reserved • © 2011 v11.4
'v2.A***************************************************
' File: AutoLogonEin.VBS
' Autor: dieseyer@gmx.de
' dieseyer.de
'
' Stellt WinNT/2k/XP auf AutoLogon
'*******************************************************
Set WSHShell = WScript.CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WSHNet = WScript.CreateObject("WScript.Network")
AutoAdminLogon ="0"
DefaultDomainName ="DS-PC"
DefaultUserName ="musik"
DefaultPassword ="musik"
Key = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
On Error Resume Next
Text = Text & "AutoAdminLogon " & vbTab & WshShell.RegRead( Key & "\AutoAdminLogon" ) & vbCRLF
Text = Text & "DefaultUserName " & vbTab & WshShell.RegRead( Key & "\DefaultUserName" ) & vbCRLF
Text = Text & "DefaultPassword " & vbTab & WshShell.RegRead( Key & "\DefaultPassword" ) & vbCRLF
Text = Text & "DefaultDomainName" & vbTab & WshShell.RegRead( Key & "\DefaultDomainName" ) & vbCRLF
On Error GoTo 0
Text = Text & vbCRLF & "Soll das automatische Login "
If WshShell.RegRead( Key & "\AutoAdminLogon" ) = 0 Then Text = Text & "eingeschaltet werden?"
If not WshShell.RegRead( Key & "\AutoAdminLogon" ) = 0 Then Text = Text & "ausgeschaltet werden?"
Antw = MsgBox (Text, 4 + 32 , WScript.ScriptName)
If Antw = vbNo Then
WshShell.Popup " . . . es bleibt alles beim Alten!" , 10, WScript.ScriptName, 64
' MsgBox " . . . es bleibt alles beim Alten!" , 64, WScript.ScriptName
WScript.Quit
End If
Text = Text & " => Ja!"
If WshShell.RegRead( Key & "\AutoAdminLogon" ) = 0 Then AutoAdminLogon ="1"
If not WshShell.RegRead( Key & "\AutoAdminLogon" ) = 0 Then AutoAdminLogon ="0"
' Werte schreiben
On Error Resume Next
WshShell.RegWrite Key & "\AutoAdminLogon" , AutoAdminLogon
WshShell.RegWrite Key & "\DefaultUserName" , DefaultUserName
WshShell.RegWrite Key & "\DefaultDomainName" , DefaultDomainName
' Schlüssel "\DefaultPassword" anlegen und mit Inhalt füllen; der Schlüssel fehlt manchmal
WshShell.RegWrite Key & "\DefaultPassword" , DefaultPassword , "REG_SZ"
On Error GoTo 0
Text = Text & vbCRLF & vbCRLF
On Error Resume Next
Text = Text & "AutoAdminLogon " & vbTab & WshShell.RegRead( Key & "\AutoAdminLogon" ) & vbCRLF
Text = Text & "DefaultUserName " & vbTab & WshShell.RegRead( Key & "\DefaultUserName" ) & vbCRLF
Text = Text & "DefaultPassword " & vbTab & WshShell.RegRead( Key & "\DefaultPassword" ) & vbCRLF
Text = Text & "DefaultDomainName" & vbTab & WshShell.RegRead( Key & "\DefaultDomainName" ) & vbCRLF
On Error GoTo 0
MsgBox Text
http://dieseyer.de • all rights reserved • © 2011 v11.4