Solved

How to update profiles in AD

Posted on 2014-09-26
5
63 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 80

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

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

Find out how to use Active Directory data for email signature management in Microsoft Exchange and Office 365.
In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
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…
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.

837 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