Solved

How to update profiles in AD

Posted on 2014-09-26
5
62 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 79

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Companies that have implemented Microsoft’s Active Directory need to ensure that the Active Directory is configured and operating properly. If there are issues found and not resolved, it eventually leads the components to fail or stop working and fi…
Last week, our Skyport webinar on “How to secure your Active Directory” (https://www.experts-exchange.com/videos/5810/Webinar-Is-Your-Active-Directory-as-Secure-as-You-Think.html?cid=Gene_Skyport) provided 218 attendees with a step-by-step guide for…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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 …

770 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