techdrive
asked on
just remove one group
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.t xt
foreach ($name in $names)
{
$name | get-qadmemberof | Remove-QADGroupMember -Member $name
names = Get-Content C:\textfiles\listofusers.t
foreach ($name in $names)
{
$name | get-qadmemberof | Remove-QADGroupMember -Member $name
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@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.
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.
Sorry was answering two questions. Your correct in that it's not qaduser, it should have read.
Get-Content C:\textfiles\listofusers.t xt | remove-QADGroupmember "groupname"
Get-Content C:\textfiles\listofusers.t
Get-Content C:\textfiles\listofusers.t