• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 70
  • Last Modified:

How to update profiles in AD

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
PBIT
Asked:
PBIT
  • 2
  • 2
1 Solution
 
VishalnarseSystem Wintel Administrator L2Commented:
Hello,

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


Thank you.
0
 
PBITAuthor Commented:
This is Windows 2008 R2.
0
 
David Johnson, CD, MVPOwnerCommented:
did you update the schema using adsiedit to reflect the hiredate property?  HireDate is not in the schema normally
0
 
PBITAuthor Commented:
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
 
VishalnarseSystem Wintel Administrator L2Commented:
Yes.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now