[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

need a script to move users by email address

Posted on 2015-02-21
3
Medium Priority
?
128 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

New Tabletop Appliances Blow Competitors Away!

WatchGuard’s new T15, T35 and T55 tabletop UTMs provide the highest-performing security inspection in their class, allowing users at small offices, home offices and distributed enterprises to experience blazing-fast Internet speeds without sacrificing enterprise-grade security.

Question has a verified solution.

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

With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
This article will help to fix the below errors for MS Exchange Server 2016 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
how to add IIS SMTP to handle application/Scanner relays into office 365.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

834 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