开发者

netusergetinfo return 2221

netusergetinfo is returning 2221 error code for valid user . What is the reason? It is becau开发者_JAVA百科se of some security setting on active directory but I am not aware of it.


Probably you have the same problem as described here Get current user's 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.


API: NetUserSetInfo / netusergetinfo Error Code: 2221 Reason: The Username you are trying to update is not present in the system.

for reference:https://learn.microsoft.com/en-us/windows/win32/netmgmt/network-management-error-codes

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜