Solved

How to update profiles in AD

Posted on 2014-09-26
5
59 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
  • 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 78

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

Join & Write a Comment

The saying goes a bad carpenter blames his tools. In the Directory Services world a bad system administrator, well, even with the best tools they’re probably not going to become an all star.  However for the system admin who is willing to spend a li…
Find out how to use Active Directory data for email signature management in Microsoft Exchange and Office 365.
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…
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 to another domain controller. Log onto the new domain controller with a user account t…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now