WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

wNT
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

wntMemberDel- Error:571

Keywords: wntMemberDel 571  

Question:

I have created a batch file that removes all the members of a group. Than put back in the member that are authorized. The batch file fails when a user Primary domain group is set on that account is there a work around. Note:It fails when it remove the users. The Error code is 571

 
AddExtender("WWWNT34I.DLL")

:Start
people=wntMemberList("\\SERVER01","ADMIN-WORKSTATION",@GLOBALGROUP)
sort = ItemSort(people, @Tab)
Cond=ItemCount(sort, @Tab)

While Cond!=0
 rmember = ItemExtract(1,sort,@TAB)
 wntMemberDel("\\SERVER01","ADMIN-WORKSTATION","%rmember%",@GlobalGroup)
 Cond=ItemCount(sort, @Tab)
 Goto Start
EndWhile

Display(5, "Winbatch notice", "All none authorized User Id's have been removed from ADMIN-WORKSTATION")

List1 = "ADMIN01 ADMIN03 ADMIN04 ADMIN05 ADMIN06"
List2 = "ADMIN07 ADMIN08 ADMIN09 ADMIN10 ADMIN11"
List3 = "ADMIN12 ADMIN13 ADMIN14 ADMIN15 ADMIN16"
List4 = "ADMIN17 ADMIN18 ADMIN19 ADMIN20 ADMIN21"

Display(5, "Winbatch notice", "Adding all authorized User Id's to ADMIN-WORKSTATION")

MemberCount = ItemCount(List1, " ")
for FileIndex = 1 to MemberCount
 addmember = ItemExtract(Fileindex,List1," ")
 add=wntMemberSet("\\SERVER01","ADMIN-WORKSTATION","%addmember%",@GLOBALGROUP)
 ItemRemove(1,List1," ")
next

MemberCount = ItemCount(List2, " ")
for FileIndex = 1 to MemberCount
 addmember = ItemExtract(Fileindex,List2," ")
 ItemRemove(1,List2," ")
 add=wntMemberSet("\\SERVER01","ADMIN-WORKSTATION","%addmember%",@GLOBALGROUP)
next

MemberCount = ItemCount(List3, " ")
for FileIndex = 1 to MemberCount
 addmember = ItemExtract(Fileindex,List3," ")
 add=wntMemberSet("\\SERVER01","ADMIN-WORKSTATION","%addmember%",@GLOBALGROUP)
 ItemRemove(1,List3," ")
next

MemberCount = ItemCount(List4, " ")
for FileIndex = 1 to MemberCount
 addmember = ItemExtract(Fileindex,List4," ")
 add=wntMemberSet("\\SERVER01","ADMIN-WORKSTATION","%addmember%",@GLOBALGROUP)
 ItemRemove(1,List4," ")
next

Display(5, "Winbatch notice", "All authorized User Id's have been addedto ADMIN-WORKSTATION")
exit

Answer:


You cannot delete a user from its primary group. Therefore you will first need to determine whether the group is the user primary group.

-First get the users primary group id.
wntUserGetDat
"primary_group_id" (i):
RID (relative ID) of the user's primary global group. You can determine a group's RID using wntGroupInfo with request = 2. Note: This element cannot be set using wntUserAddDat.

-Get group Id of the group in which you are deleting users.
wntGroupInfo
request = 2 ;group's RID (relative identifier)
This request is valid only with global groups

If the are the same you do not want to attempt to delete that user until you have set a new primary group using wntUserSetDat to set the...
"primary_group_id" (i):
RID (relative ID) of the user's primary global group. You can determine a group's RID using wntGroupInfo with request = 2. Note: This element cannot be set using wntUserAddDat.


Article ID:   W14269
Filename:   wntMemberDel- error 571.txt
File Created: 2001:03:01:14:19:34
Last Updated: 2001:03:01:14:19:34