Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to update profiles in AD

Posted on 2014-09-26
5
Medium Priority
?
69 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 84

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 2000 total points
ID: 40365305
Yes.
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

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

Wouldn't it be nice if objects in Active Directory automatically moved into the correct Organizational Units? This is what AutoAD aims to do and as a plus, it automatically creates Sites, Subnets, and Organizational Units.
It’s time for spooky stories and consuming way too much sugar, including the many treats we’ve whipped for you in the world of tech. Check it out!
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…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses

916 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