![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
|
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | remove user from all groups but 1 been banging my head against the wall trying to script the removal of a user from all group member ships but one ie user is memberof {xxx,ccc,ggg,mailing list,mailing list,etc} want to remove them from all but xxx (which is already set to primary group) |
My System Specs![]() |
| | #2 (permalink) | ||||||||||||
| Guest | Re: remove user from all groups but 1 This should do what you ask... the key is that if the user has a primary group set... it will not let you remove it. I just have a small VM DC, but it worked perfectly for me. $user = [ADSI]"LDAP://$userDN" $groups = $user.memberof foreach($group in $groups) { $groupDE = [ADSI]"LDAP://$group" $groupDE.remove("LDAP://$($user.distinguishedName)") } "voodooking" <voodooking@xxxxxx> wrote in message news:B71D1C72-80EB-4571-A2DA-9D852A67A742@xxxxxx
| ||||||||||||
My System Specs![]() | |||||||||||||
|
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Remove Users From All Groups | JSC | PowerShell | 3 | 06-12-2008 03:27 PM |
| Script to remove list of users from groups... | Ron | VB Script | 2 | 06-04-2008 11:15 AM |
| blocking user in mail groups | Rodders | Vista General | 6 | 06-29-2007 11:23 AM |
| User Groups in Vista | jmurray75 | Vista account administration | 0 | 03-03-2007 05:55 AM |