Solved

How to import profiles to update them?

Posted on 2014-09-15
3
99 Views
Last Modified: 2014-09-15
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
0
Comment
Question by:PBIT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 40324222
There is no HireDate attribute in AD (Unless you added a custom attribute using schema modification). You can update the HireDate in user description or notes. Following is an sample code to update the HireDate to user description.

Import-Module ActiveDirectory 
Import-Csv C:\User.csv | %{
 Set-ADUser $_.SamAccountName -Description $_.HireDate
}

Open in new window

0
 

Author Comment

by:PBIT
ID: 40324312
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}
0
 
LVL 40

Expert Comment

by:Subsun
ID: 40324627
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

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This article outlines the process to identify and resolve account lockout in an Active Directory environment.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question