?
Solved

need a script to move users by email address

Posted on 2015-02-21
3
Medium Priority
?
115 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will help to fix the below errors for MS Exchange Server 2013 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…
Active Directory can easily get cluttered with unused service, user and computer accounts. In this article, I will show you the way I like to implement ADCleanup..
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses
Course of the Month9 days, 9 hours left to enroll

762 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