Solved

just remove one group

Posted on 2012-04-03
4
501 Views
Last Modified: 2012-04-03
I am trying to remove one group from a list of users. Can you guys tell me the best place to enter this in the script, thanks

names = Get-Content C:\textfiles\listofusers.txt

foreach ($name in $names)
{
$name | get-qadmemberof | Remove-QADGroupMember -Member $name
0
Comment
Question by:techdrive
  • 2
  • 2
4 Comments
 
LVL 26

Accepted Solution

by:
pony10us earned 500 total points
ID: 37801915
http://ss64.com/ps/remove-qadgroupmember.html

names = Tet-Content D:\textfiles\listofusers.txt
foreach ($name in $names)
{
$name | remove-QADGroupMember 'CN=group,OU=ou,DC=dc,DC=com' -member $name
}

The get-qadmemberof is to get a list of members in a group so shouldn't be needed if you are working from a list (c:\textfiles\listofusers.txt) that you already know are members of the group
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 37801975
In its simplist form you would use.....

Get-Content C:\textfiles\listofusers.txt | remove-QADUser "GroupName"
0
 
LVL 26

Expert Comment

by:pony10us
ID: 37802026
@Neilsr: is "remove-QADUser" something new?  I am only aware of these options for QADUser:

 Get-QADUser           Retrieve users that match specific conditions
 Set-QADUser           Modify attributes of a user account
 New-QADUser           Create a new user account
 Enable-QADUser        Enable a user account
 Disable-QADUser       Disable a user account
 Unlock-QADUser        Unlock a user account
 Deprovision-QADUser   Deprovision a user account in AD

I have seen this one to remove all but the primary group from a user:

Get-QADUser $_.EmpID | Remove-QADMemberOf -RemoveAll


EDIT:  Just thought about this reply some more and got to thinking.  I was not attempting to be difficult here.  I was simply asking to see if it was something I wasn't aware of thereby providing me with another learning opportunity.
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 37802352
Sorry was answering two questions. Your correct in that it's not qaduser, it should have read.

Get-Content C:\textfiles\listofusers.txt | remove-QADGroupmember "groupname"
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Set OWA language and time zone in Exchange for individuals, all users or per database.
"Migrate" an SMTP relay receive connector to a new server using info from an old server.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question