need a script to move users by email address

can someone provide a script I can use to move a set of users on a CSV file and key on email address, and move to a destination OU in active directory?

thx much!

s.
siber1Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
siber1Connect With a Mentor Author Commented:
I ended up figuring it out

here is the code I used:

$TargetOU = "DC=mydomain,DC=com"
$IDs = Import-CSV users.csv | Select -ExpandProperty mail
Get-ADUser -filter * -Properties mail | Where { $IDs -contains $_.mail } | 
 Move-ADObject -TargetPath $TargetOU

Open in new window

0
 
Will SzymkowskiSenior Solution ArchitectCommented:
So you have a list of usernames and you want to add an email address to each account and move the objects to a different OU?

Just trying to understand the question.

Will.
0
 
siber1Author Commented:
figured it out myself
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.