Richard Siddaway's Blog

 

The standard approach to the bulk modification of users is to create a CSV file with an identifier and the data you want to change. Here’s part of a CSV file that could be used to modify some AD attributes – Division, City and Office

SamAccountName,Division,Office,City
mgreen,Accounting,”Main Office”,”New York”
dgreen,Sales,”North East”,Boston
jgreen,Marketing,”North West”,Seattle
bkent,Manufacturing,”North”,Chicago

I always like to first test what is set

$users=Import-Csv-PathC:\Scripts\adtest.csvforeach($userin$users){Get-ADUser-Identity$user.SamAccountName-Properties*|selectSamAccountName,Division,Office,City}

A simple loop through each user and display the data. I’ve used –Properties * to ensure that I get the data I want. I could have put the attribute names in to restrict the returned data – might be a good idea if you are working with lots if user accounts at once

With Set-ADUser you get…

View original post 310 altre parole