Solved

need a script to move users by email address

Posted on 2015-02-21
3
92 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
ID: 40623613
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
ID: 40623676
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
ID: 40641496
figured it out myself
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…

911 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

22 Experts available now in Live!

Get 1:1 Help Now