I'm using a workstation in an Active Directory domain, trying to impersonate another user. The user AULAS\Aula11 (or email@example.com) has administrative privileges in the domain, as it also has AULAS\Aula8, and both have blank passwords, but the following VB .NET code failsPrivate Declare Function LogonUser Lib "advapi32.dll" Alias _ "LogonUserA" (ByVal lpszUsername As String, _ ByVal lpszDomain As String, ByVal lpszPassword As String, ByVal dwLogonType As Integer, _ ByVal dwLogonProvider As Integer, ByRef phToken As IntPtr) As Integer If LogonUser("Aula11", "AULAS", vbNullString, 3, 0, elToken) <> 0 Then
Console.WriteLine("El usuario pepe ha sido identificado") Else
Console.WriteLine("El usuario pepe NO ha sido identificado") End If
Console.ReadLine()with error 1326, unknown user name or bad password.
Finally, note I have also try LogonUser with domain "aulas.es", with the same errror 1326.
Please help.Friday, December 01, 2006 12:45 PM
Neither works the program using "" as password instead of vbNULLstring. I think there is some problem accessing Active Directory's users, maybe DNS or DHCP misconfiguration; or maybe there is some misconfiguration of premissions to do a network login using an account with blank passwords???Monday, December 04, 2006 10:09 AM
Ociretsih Yahoo said:
Neither works the program using "" as password instead of vbNULLstring. I think there is some problem accessing Active Directory's users, maybe DNS or DHCP misconfiguration; or maybe there is some misconfiguration of premissions to do a network login using an account with blank passwords???
I'm now using this funcions on my servers(win2008) and suffered from similar circumstance.
Here's my situation:
Domain Account: Karsen.com\AA password:123aA (Domain Admin privilege)
Machine: A, which joined the domain Karsen.com
Machine Account: Administrator password:xx56ZZ (Local Admin)
if (!LogonUser(argv, NULL, argv, LOGON32_LOGON_INTERACTIVE,
And I login A with account AA@karsen.com, then I perform some test:
I can successfully LogonUser by "\Administrator" + "xx56ZZ".
but when I try to LogonUser by "Karsen.com\AA" or AA@karsen.com + "123aA".
I always got the following error:
ERROR: API = LogonUser.
error code = 1326.
message = Logon failure: unknown user name or bad password.
Could anyone give me some advice?Monday, March 23, 2009 7:41 AM