import AD value from csv file

cawasaki
cawasaki used Ask the Experts™
on
hi,

i have a csv file like this:

samaccountname,departement

i need a script or command line to get every user from this file and set his departement value.

i have powershell v2 and quest powershell installed

thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Active Directory Engineer
Top Expert 2012
Commented:
Try this using Quest PowerShell

Import-CSV c:\users.csv | %{ Get-QADUser $_."samaccountname" | Set-QADUser -Department $_."department" }

Open in new window


and this one for Windows PowerShell module for AD

Import-CSV c:\users.csv | %{ Get-ADUser $_."samaccountname" | Set-ADUser -Department $_."department" }

Open in new window


Regards,
Krzysztof

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial