$CostCenters = "200", "212", "218"
foreach ($CostCenter in $CostCenters){
#Add Users
get-qaduser -ldapfilter "(fmCostCenter=$CostCenter)" -notmemberof "Cost_Center_Group_$CostCenter" | Add-QADGroupMember "Cost_Center_Group_$CostCenter"
#Remove Users
Get-QADGroupMember "Cost_Center_Group_$CostCenter" -LdapFilter "(!(fmCostCenter=$CostCenter))" | foreach{Remove-QADGroupMember "Cost_Center_Group_$CostCenter" $_}
}
ASKER
ASKER
ASKER
ASKER
Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to the Component Object Model (COM) and Windows Management Instrumentation (WMI), enabling administrators to perform administrative tasks on both local and remote Windows systems as well as WS-Management and Common Information Model (CIM) enabling management of remote Linux systems and network devices.
TRUSTED BY
http://www.quest.com/powershell/activeroles-server.aspx
Depending on what your group names are you will need to modify the script. This script uses the group names of
"Cost_Center_Group_200"
"Cost_Center_Group_212"
"Cost_Center_Group_218"
Open in new window