Solved

How to import profiles to update them?

Posted on 2014-09-15
3
95 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
  • 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

860 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