Hi Dusan
That seems to be near enough what I need except it leaves one group other than the Domain users (That I know of)
That group is our Broadcast all staff Group which is our Distribution list for all staff for mass email. The Group itselfs is set up as a Security type. I know group mod can only do a 100 groups unless you set the limit to more, but where abouts would i set this limit on what you have written?
Many thanks
Main Topics
Browse All Topics





by: Dusan_BajicPosted on 2009-11-03 at 08:45:23ID: 25730826
This will list members of OU, for each member it will list groups, then it will remove member from each group. User will remain member of his primary group (Domain Users)
OU=Account s - Archive,DC=Home,DC=co,DC=u k"') DO (
For /F "delims=*" %%w IN ('dsquery user -desc Archived* "OU=Data Has Been Archived,OU=Base,OU=Staff,
For /F "delims=*" %%g IN ('dsget user %%w -memberof -expand') DO (
dsmod group %%g -rmmbr %%w
)
)