Link to home
Start Free TrialLog in
Avatar of PBIT
PBITFlag for United States of America

asked on

How to import profiles to update them?

Hello,

I like to update an attributed in a profile for users in Active directory. I like to use the Import-Csv PowerShell command to do that. What would it look like if was going to update  one attribute name HireDate?  

Import-Csv .\users.csv   Not sure what would go here.

Users.scv would look like this:

GivenName,Surname,Name,DisplayName,SamAccountName,HireDate
Bob,Jones,Bob Jones,Bob Jones, bjones, 5/5/2000
ASKER CERTIFIED SOLUTION
Avatar of SubSun
SubSun
Flag of India 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 PBIT

ASKER

Correct, the HireDate is a custom attributed added.  So, it would look like this?

Import-Module ActiveDirectory
Import-Csv C:\User.csv | %{Set-ADUser $_.SamAccountName -HireDate $_.HireDate}
There is no  -HireDate parameter for Set-ADUser command, try with following code..
Import-Csv C:\User.csv | %{Set-ADUser $_.SamAccountName –replace @{HireDate=$_.HireDate}}

Open in new window