'this tip uses the code shown in the previous tip
Public Sub SetAutomaticNTLogon(User As String, Password As String, Domain As String)
SetRegValue HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon", "AutoAdminLogon", "1"
SetRegValue HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon", "DefaultUserName", User
If Password = "" Then
DeleteValue HKEY_LOCAL_MACHINE,
"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon",
"DefaultPassword"
Else
SetRegValue HKEY_LOCAL_MACHINE,
"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon",
"DefaultPassword", Password
End If
SetRegValue HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon", "DefaultDomainName", Domain
End Sub |