25
Import-CSV C:\scripts\users.csv -Header users | ForEach-Object {Add-AdGroupMember
-Identity "Quality" -members $_.users}
To add users to group from a CSV file, run the following PowerShell script:
Get-ADGroupMember “Quality” | Get-ADUser | ForEach-Object {Add-ADGroupMember
-Identity “QualityControl” -Members $_}
If you want to copy all members from one group to another group, run the following script:
Import-CSV C:\scripts\users.csv -Header users | ForEach-Object {Remove-ADGroupMember
-Identity "Quality" -members $_.users}
Get-ADUser -Identity E.Franklin -Properties MemberOf | ForEach-Object {
$_.MemberOf | Remove-ADGroupMember -Members $_.DistinguishedName -Confirm:$false
}
To remove a user from all groups, run this script:
Do'stlaringiz bilan baham: