1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
Imports Microsoft.Win32.Registry
Imports Microsoft.Win32.RegistryKey
Function AutoLogonEnabled() As Boolean
Dim Autologon As Boolean
Dim AutoAdminLogon As String
Dim AutoLogOnPassword As String
Dim AutoLogOnUser As String
Try
AutoLogOnUser = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultUserName", "")
Catch ex As Exception
End Try
Try
AutoLogOnPassword = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword", "")
Catch ex As Exception
MessageBox.Show("Autologon will fail: No password set", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Try
Try
AutoAdminLogon = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon", "")
If AutoAdminLogon = 1 Then
Autologon = True
Else
Autologon = False
End If
Catch ex As Exception
End Try
Return Autologon
End Function
|