Solved

How to import profiles to update them?

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
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 …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

705 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