Link to home
Start Free TrialLog in
Avatar of CiscoAzn
CiscoAznFlag for United States of America

asked on

Bulk changes in Active Directory

After aquiring several companies we need to change the AD description fro all accounts. Each OU has 200-300 AD accounts and i want to change the City, State, ...etc. How do i do this in bulk instead of doing it one at a time?
Avatar of Joseph Moody
Joseph Moody
Flag of United States of America image

Use the following command below for your needs...

CSV file needs to be created as follows...

sAMAccountName    City             State   Description
bsmith                           NewTown   NY       Accounting Dept
mcooper                        Drysdale     AR       Human Resources
So on....

Script below...
Import-Module activedirectory
$Users2Mod = Import-Csv c:\yourCSVFileHere.csv
$Users2Mod = Foreach ($Person in $Users2Mod) {
$Person.SamAccountName
$Person.Description
$Person.State
$Person.City
Set-ADUser -Identity $Person.SamAccountName -Description $Person.Description -City $Person.City -State $Person.State
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of LibranDragon
LibranDragon
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial