tags:

views:

33

answers:

1

netusergetinfo is returning 2221 error code for valid user . What is the reason? It is because of some security setting on active directory but I am not aware of it.

+1  A: 

Probably you have the same problem as described here http://stackoverflow.com/questions/3371807/get-current-users-last-logon/.

One possible reason is that you don't use UNICODE format for the user name.

Another problem is if you try to ask the name of domain user. In this case you should use not a form

nStatus = NetUserGetInfo (NULL, L"Domain\\TestUser", dwLevel, (LPBYTE *) & pBuf);

but use as the first parameter the name of a domain controller from a domain which has trust to domain "Domain". You can use DsGetDcName or NetGetAnyDCName or NetGetDCName to get this name.

To answer on your question exactly you should post the corresponding source code and describe shortly your domain environment and the role of the computer and the current user under which current process are running.

Oleg