Monday, December 5, 2011

Remove a particular group from List of users

Hi Readers,

I have came acros a situation where I have to remove a group from thosand of users.

Thanks to Quest Active Directory Mangement roles :)

Install these on your machine & below is the small script that takes input from CSV file(Columns in CSV file---> group, username)

for execution : Script.ps1 csv file

# import csv file

$data = import-csv $args[0]

 #Check if usr belogs to group in csv

 foreach ($i in $data)

{

$grp=$i.group

$Can = “CN=$grp”

$user=get-qaduser $i.username



if (($user.memberof -like “$Can,*”))

{

write-host “$user is a member & will be removed from Enterprise vault group”

 remove-qadgroupmember $grp $user  }

}

4 comments:

  1. Thanks for sharing such a pleasant thought, paragraph
    is good, thats why i have read it fully

    ReplyDelete
  2. Howdy! I just would like to give you a big thumbs
    up for the great information you've got here on this post. I am coming back to your web site for more soon.

    ReplyDelete
  3. I comment when I especially enjoy a article on a site or if
    I have something to valuable to contribute to the conversation.

    It is triggered by the passion communicated in the post I read.
    And after this post Remove a particular group from List of users « SukhijaVikas's Blog. I was excited enough to
    post a commenta response :-P I do have 2 questions for you if you do not mind.
    Is it only me or does it look as if like a few of these remarks look like they
    are written by brain dead visitors? :-P And, if you are writing at additional sites, I would like to follow you.
    Could you make a list the complete urls of all your communal sites like your twitter feed,
    Facebook page or linkedin profile?

    ReplyDelete
  4. Hi,
    I generally write on this blog only, ones in a blue moon I visit different Microsoft communities & comment.

    Thanks
    Sukhija Vikas

    ReplyDelete