Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Netusergetinfo is returning 2221(user not found) error code for valid user on Win2003 active directory. The user is valid and present in the active directory. The process which is making a call to netusergetinfo is running under account SYSTEM. My guess is it due to some permissions/settings on active directory but I am not aware of it. Anyone has ideas?

share|improve this question

Yes, the problem was with servername parameter that we were passing to Netusergetinfo

We were getting it from call to function NetGetDCName and if that function failed we were siliently setting the servername to NULL.

Due to this Netusergetinfo was trying to enumerate local users which resulted in 2221 'user not found error'

The function NetGetDCName was failing with error code 2453 NERR_DCNotFound.

This is due to incorrect DNS settings on the host due to which it is unable to lookup the primary domain controller.

share|improve this answer

Just a thought, but make sure the servername parameter is set to a valid domain controller of the domain. If you're pointing to a non-DC then the API call is getting results back from the server's local users.

You might also consider using ADSI instead for hooking into AD.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.