Solved

need a script to move users by email address

Posted on 2015-02-21
3
90 Views
Last Modified: 2015-03-03
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.
0
Comment
Question by:siber1
  • 2
3 Comments
 
LVL 53

Expert Comment

by:Will Szymkowski
Comment Utility
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
 

Accepted Solution

by:
siber1 earned 0 total points
Comment Utility
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
 

Author Closing Comment

by:siber1
Comment Utility
figured it out myself
0

Featured Post

Why do Marketing keep bothering you?

Is your marketing department constantly asking for new email signature updates? Are they requesting a different design for every department? Do they need yet another banner added? Don’t let it get you down! There is an easy way to manage all of these requests...

Join & Write a Comment

Synchronize a new Active Directory domain with an existing Office 365 tenant
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now