Solved

How to update profiles in AD

Posted on 2014-09-26
5
66 Views
Last Modified: 2014-11-21
Hello,

I have this script below that works great for users in one domain.  But I like to use the script to update users in another domain.  How can I use this script to ensure users are being updating for a particular domain?


`Import-Module ActiveDirectory            
$users = import-csv -path d:\scripts\hiredatepls.csv
foreach($user in $users)
{    
$fielduser = $user.SamAccountName
$fielddate = $user.HireDate -as [datetime]
echo "$fielduser,$fielddate"
Set-ADUser $fielduser  -Replace @{HireDate = $fielddate}
}
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
  • 2
5 Comments
 
LVL 4

Expert Comment

by:Vishalnarse
ID: 40346638
Hello,

May I know which OS server you are using? Then I can check and assist you in a better manner.


Thank you.
0
 

Author Comment

by:PBIT
ID: 40346728
This is Windows 2008 R2.
0
 
LVL 81

Expert Comment

by:David Johnson, CD, MVP
ID: 40346775
did you update the schema using adsiedit to reflect the hiredate property?  HireDate is not in the schema normally
0
 

Author Comment

by:PBIT
ID: 40346782
Yes, hiredate is a property for each profile.  

Do I need to specify DC=domain DC=com?  Or, will the script find the username in other domains?
0
 
LVL 4

Accepted Solution

by:
Vishalnarse earned 500 total points
ID: 40365305
Yes.
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

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

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
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 …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

728 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