NetLocalGroupAddMembers
-
Hey guys, I am trying to add a member into a group. A user and a group already exists, but if I call this function, I get the system error code 1376: The specified local group does not exist. I recognized that if I call this function after creating a user it success. So what can I do here ??? see my code:
USES_CONVERSION; wchar_t *pswzGroup = T2W("A"); wchar_t *pswzUser = T2W("X"); LOCALGROUP_MEMBERS_INFO_3 localgroup_members; localgroup_members.lgrmi3_domainandname = pswzUser; nStatus=NetLocalGroupAddMembers(NULL,pswzGroup,3,(LPBYTE)&localgroup_members,1); if(nStatus == NERR_Success) return "Groups(s) added succesfully to the group.\r\n"; if(nStatus == ERROR_ACCESS_DENIED) return "Access denied.\r\n"; if(nStatus == NERR_GroupNotFound) return "The user does not have access to the requested information.\r\n"; if(nStatus == ERROR_NO_SUCH_MEMBER) return "One or more of the members specified do not exist. Therefore, no new members were added.\r\n"; if(nStatus == ERROR_MEMBER_IN_ALIAS) return "One or more of the members specified were already members of the local group. No new members were added.\r\n"; if(nStatus == ERROR_INVALID_MEMBER) return "One or more of the members cannot be added because their account type is invalid. No new members were added.\r\n"; else{ CString str; str.Format("Error->Code: %d\r\n",nStatus); return str; }
thanks, sonu da sonu :cool: