Link to home
Start Free TrialLog in
Avatar of gd6627
gd6627Flag for United States of America

asked on

AD Powershell

I need to update user parameter fields in AD like  Description , office , job tittle, Department, Conmpany and Manager.

I have a csv file from a payroll system that I need to use as master file ,

I would like a powershell script that can read the user file and update those fields in AD
Avatar of Justin Yeung
Justin Yeung
Flag of United States of America image

assume your csv header is samaccountname,description,office,department,company,manager

$objects = import-csv -Path c:\temp\import.csv

foreach ($Object in $objects)
{
Set-ADUser $Object.SamAccountname `
-Description $object.description `
-Office $Object.office `
-Department $object.department `
-Company $object.company `
-Manager (Get-ADUser $object.Manager)
}

Open in new window

Avatar of gd6627

ASKER

Justin if I already have the manager sam account associated with the user can I just list it in the csv file?  I also need to add job title
ASKER CERTIFIED SOLUTION
Avatar of Justin Yeung
Justin Yeung
Flag of United States of America 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
Avatar of gd6627

ASKER

How about job title? and I also need to add address, city, state , zip code