How to move users between OU's from an exported list

Hey Guys
New to Powershell
We are going to move large number of users from one OU to another.. For that I am using
get-aduser -filter * -searchbase "OU=ou1,DC=domain" | move-adobject -targetpath "OU=ou2,DC=domain"
As a backout plan we want to reverse that.. so what I am thinking is to right click on the OU1 and export list as txt. So we have all users in a tab/csv format with username.. How can I then write a one liner / script to search for all the users in the list
in AD (or in specific OU2 in AD) and then move them to another OU (or OU1 as above example)?
Or if there is a better quicker method please let me know.
Cheers

Hi,
Here's something to start with:
$targetOU = 'OU=Test 2,DC=domain,DC=com'
Get-ADUser -Filter * -SearchBase 'OU=Test 1,DC=domain,DC=com' | ForEach {
$props = @{
Name = $_.Name
Username = $_.SamAccountName
OriginalOU = ($_.DistinguishedName -split ',OU=' -split ',')[1]
NewOU = ''
Status = ''
try {
Move-ADObject -Identity $_.DistinguishedName -TargetPath $targetOU -ErrorAction Stop
$props.NewOU = ($targetOU -split ',' -replace 'OU=','')[0]
$props.Status = 'Success'
} catch {
$props.Status = 'FAILED'
New-Object PsObject -Property $props
} | Sort Name | Select Name,Username,OriginalOU,NewOU,Status | Export-Csv .\userMoveDetails.csv -NoTypeInformation
Don't retire TechNet! -
(Don't give up yet - 12,950+ strong and growing)
Sorry new to coding.. but this looks awefully complicated for my situation.. Won't the code which I have said simple move users from one container to another existing one? Just need to know how to do the reverse if needed .. OU2 will already have users..
so need to differentiate and was thinking the right click on OU1 and export list.
Thanks

Similar Messages

  • How to move users between databases

    Hi everyone,
    I am looking for a way to move a database with one schema holding data and around 50 users without objects to another machine.
    I will move the schema with data by using Data Pump. But what's the best way to copy the users with passwords and grants?
    Thanks in advance

    932139 wrote:
    Hi everyone,
    I am looking for a way to move a database with one schema holding data and around 50 users without objects to another machine.
    I will move the schema with data by using Data Pump. But what's the best way to copy the users with passwords and grants?
    which metric measures "best" for you?
    http://www.orafaq.com/forum/m/120560/42800/?srch=cr_user_like#msg_120560

  • How to move files between folders within Lightroom 3?

    I would like to move a file from one folder to another within Lightroom 3 (let's not discuss why). I searched the threads but couldn't find the answer (maybe I missed it). When I click on a photo within grid view then drag and drop that file onto a different folder in the folder panel (to do the move), a little plus sign (copy) appears and a copy of the file is placed in the second folder. If I try to delete the photo from the original folder (to get the move), both copies of the file are removed. I've tried holding down all sorts of keys on the imac but cannot get the move to work. Ideally, I'd like to move a group of photos but cannot even move one. Does anyone know how to move files between folders in Lightroom 3?

    Your suggestion works. Thank you for posting it.
        Ron
    2010/10/28 Dorin Nicolaescu-Musteață <[email protected]>
    Try selecting the photos, right-clicking the target folder and choosing
    "Move Selected Photos to This Folder".
    >

  • How to move a specific tablespace datafile from one directory to another

    Database: 10.2.0.1
    OS : Generic
    Problem Description : How to move a specific tablespace datafile from one directory to another considering that the database is on Oracle Dataguard setup
    ** Oracle is working on this issue, but in parallel is opening the topic to the Community so that Community members can add their perspective, experience or knowledge. This will further enhance all knowledge bases including My Oracle Support and My Oracle Support Communities **
    Edited by: ram_orcl on 16-Aug-2010 21:21

    Dear ram_orcl,
    Please follow the procedures here;
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14239/manage_ps.htm#i1034172
    8.3.4 Renaming a Datafile in the Primary Database
    When you rename one or more datafiles in the primary database, the change is not propagated to the standby database. Therefore, if you want to rename the same datafiles on the standby database, you must manually make the equivalent modifications on the standby database because the modifications are not performed automatically, even if the STANDBY_FILE_MANAGEMENT initialization parameter is set to AUTO.
    The following steps describe how to rename a datafile in the primary database and manually propagate the changes to the standby database.
       1.
          To rename the datafile in the primary database, take the tablespace offline:
          SQL> ALTER TABLESPACE tbs_4 OFFLINE;
       2.
          Exit from the SQL prompt and issue an operating system command, such as the following UNIX mv command, to rename the datafile on the primary system:
          % mv /disk1/oracle/oradata/payroll/tbs_4.dbf
          /disk1/oracle/oradata/payroll/tbs_x.dbf
       3.
          Rename the datafile in the primary database and bring the tablespace back online:
          SQL> ALTER TABLESPACE tbs_4 RENAME DATAFILE      2> '/disk1/oracle/oradata/payroll/tbs_4.dbf'
            3>  TO '/disk1/oracle/oradata/payroll/tbs_x.dbf';
          SQL> ALTER TABLESPACE tbs_4 ONLINE;
       4.
          Connect to the standby database, query the V$ARCHIVED_LOG view to verify all of the archived redo log files are applied, and then stop Redo Apply:
          SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
          SEQUENCE# APP
          8 YES
          9 YES
          10 YES
          11 YES
          4 rows selected.
          SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
       5.
          Shut down the standby database:
          SQL> SHUTDOWN;
       6.
          Rename the datafile at the standby site using an operating system command, such as the UNIX mv command:
          % mv /disk1/oracle/oradata/payroll/tbs_4.dbf /disk1/oracle/oradata/payroll/tbs_x.dbf
       7.
          Start and mount the standby database:
          SQL> STARTUP MOUNT;
       8.
          Rename the datafile in the standby control file. Note that the STANDBY_FILE_MANAGEMENT initialization parameter must be set to MANUAL.
          SQL> ALTER DATABASE RENAME FILE '/disk1/oracle/oradata/payroll/tbs_4.dbf'
            2> TO '/disk1/oracle/oradata/payroll/tbs_x.dbf';
       9.
          On the standby database, restart Redo Apply:
          SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE
            2> DISCONNECT FROM SESSION;
    If you do not rename the corresponding datafile at the standby system, and then try to refresh the standby database control file, the standby database will attempt to use the renamed datafile, but it will not find it. Consequently, you will see error messages similar to the following in the alert log:
    ORA-00283: recovery session canceled due to errors
    ORA-01157: cannot identify/lock datafile 4 - see DBWR trace file
    ORA-01110: datafile 4: '/Disk1/oracle/oradata/payroll/tbs_x.dbf'Hope That Helps.
    Ogan

  • How to make report with access 2010 from SharePoint Discussion lists 2013

    HI,
    I want to make an access report from SharePoint Discussion lists 2013. When i open the list with access, the body of the list is in HTML format in access. Also if i reply something to one subject in the discussion, the reply is not mapped to that subject
    but instead it is shown as a separate entry in the database.
    Anyone can please help?
    SAN
    Santhiya
    Santhiya

    Hi Santhiya,
    I have seen a similar post from you, my understanding is that you wonder that the reply is mapped to the related subject. You can take a look at Daniel's reply in the following thread:
    http://social.technet.microsoft.com/Forums/en-US/dfb5bcb9-0076-412a-b34f-46aa9cfba876/how-to-make-report-with-access-2010-from-sharepoint-discussion-lists-2013?forum=sharepointgeneral
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Me and my dad share an iTunes account and all of his music he has purchased on ITunes shows up on my songs list with a cloud icon next to it. How do I get rid of these from my songs list? Cuz it's doing the same thing on my iPhone

    Me and my dad share an iTunes account and all of his music he has purchased on ITunes shows up on my songs list with a cloud icon next to it. How do I get rid of these from my songs list? Cuz it's doing the same thing on my iPhone.

    Go to Edit > Preferences > Store, and uncheck the box for "Show iTunes in the Cloud purchases."

  • How to Move users from one OU to another

    I need move user for one OU another, but show error
    this my script:
    Import-Module activedirectory
    $Users = Import-Csv -Delimiter ";" -Path "D:\Joan\teste.txt"
    foreach ($User in $Users)
        $DisplayName = $User.Usuarios
        $TempUser = Get-ADUser -Filter { DisplayName -like $DisplayName }
    Move-ADObject -Identity $DisplayName -TargetPath "OU=teste,DC=teste,DC=br"
    This error:
    ove-ADObject : Não é possível localizar um objeto com identidade: 'ALCIDES ALVES MACHADO                                                                      
    ' em: 'DC=teste,DC=br'.
    Em linha:8 caractere:14
    + Move-ADObject <<<<  -Identity $DisplayName -TargetPath "OU=teste,DC=teste,DC=br"
        + CategoryInfo          : ObjectNotFound: (ALCIDES ALVES M...               :ADObject) [Move-ADObject], ADIdentityNotFoundException
        + FullyQualifiedErrorId : Não é possível localizar um objeto com identidade: 'ALCIDES ALVES MACHADO                                                                      
    ' em: 'DC=teste,DC=br'.,Microsoft.ActiveDirectory.M
       anagement.Commands.MoveADObject

    I try, but... :/
    Move-ADObject : Não é possível validar o argumento no parâmetro 'Identity'. O argumento é nulo. Forneça um argumento que não seja nulo e tente o comando novamente.
    Em linha:8 caractere:25
    +  Move-ADObject -Identity <<<<  $TempUser.distinguishedname -TargetPath "OU=teste,DC=teste,DC=br"
        + CategoryInfo          : InvalidData: (:) [Move-ADObject], ParameterBindingValidationException
        + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.MoveADObject

  • How to move pages between documents WITHOUT elements shifting

    Hi everyone! My team members and I are so frustrated over what I think should be a really simple issue: copying/moving/dragging pages between documents and NOTHING CHANGING.
    Whenever we move pages between documents (which we have to do on a monthly basis - moving content into client branded files), at least ONE thing will shift and it usually has to do with overset text and/or text wrap. We have googled our brains out. We've tried everything on this list How-To: 10 Techniques for Copying Pages Between InDesign Documents | CreativePro.com and in the various Lynda tutorials we've looked at. We have combined our powers and still can not solve this problem so now I come to you, hoping that you can please please please help us figure out this issue before one of us throws a computer out the window.
    We have this one document. And this is what one of the problem pages looks like. Everything is on one layer. (look at the section marked 5)
    Then I move the pages (copy/paste the content; drag and drop the pages; etc.) into the destination document so we can apply branding.
    AND THIS HAPPENS.
    WHY does this text suddenly become overset?
    The preferences of both documents are IDENTICAL. In fact, Document B was originally created from Document A.
    AND FUN FYI: I took Document A and Saved As a new name. Opened it the new name. And tried moving the pages into the newly named document -- and the SAME EXACT THING HAPPENED.
    I am going to bash my head into a wall. Can someone please shed some light on this? Have you seen this before? How do we fix it??

    aschwartau wrote:
    Doesn't saving as IDML lose some of the properties if you use any shadow or other effects?
    That's not something that I have ever heard, but since I haven't heard everything, I suppose it's possible. What you may be thinking of is that some people use idml to migrate a file to a lower version, and if that lower version lacks a feature of the version that created the file, you will either lose or modify the way that that feature worked in the original. I don't think that even in that scenario that a feature that was present in both versions would go away just because it took a trip through idml to get to an earlier version. And if idml botched shadow or effects, nobody would use it, and I don't think Adobe would have it.
    aschwartau wrote:
    If we had just done a final Save As on the Document A before giving it to the team member who's going to be copying the content into Document B, does that not count as doing a Save As? You mean the minute it's freshly opened try doing another Save As? (P.S. Edit: Just tried this. Didn't change what happened. )
    The thing that Save-As does is remove little bits of data associated with undos that a normal Save retains. Sometimes this data can lead to problems, so any time you do it, it will help, but if you do it at stage 37 and you hand off at stage 38, you will have cleared out most all of anything that may have built up over time. I don't want to give the impression that it is required, but it certainly doesn't hurt, and is probably a good idea to Save-As periodically.

  • HOW TO MOVE FILES BETWEEN FOLDERS ON APPLICATION SERVER

    Hi ,
    I want to move files between folders on application servers and also on presentation server.
    Is any ABAP code available for it.
    Can anybody help me out in this.
    Waiting for reply.
    Thanks & regards,
    Nitin

    I am also interested in this post. The FB  ARCHIVFILE_SERVER_TO_SERVER workes fine for copying the file, however I also need to remove the file from its original location.
    Does anybody have a sugestion on how I can do that (in coding).
    Regards,
    Minim

  • How to move only subset of data from one database to another?

    Both source & destination are Oracle11g databases.
    The requirement details are as below,
    1) The database contains static as well as transactional data for telecom domain.
    2) We have to move region-wise data from one database to another.
    3) There are around 10 regions.
    4) The region wise data extraction from source db is based on around 40 to 50 tables. Rest of the tables contains
    static data & it will not change.
    5) The volume is around 1 million subscribers per region.
    6) The migration is required because
    a) The client is upgrading its base product which uses this database
    b) There is a change in structure of static tables
    c) Hardware upgrade
    d) The client want to start with single region on new database & rest of the regions will be operated from old
    database.
    7) Keep execution time to very minimum.
    I am thinking to have solution as below,
    1) Create destination database with upgraded db structure (as mentioned in 6b)
    2) Create database links to access source db in destination db.
    3) Write SQL queries to fetch data from all the respective tables for a specific region
    4) Write separate PL/SQL blocks for each table to fetch data from source db & insert into respective table in
    destination db
    a) Use FOR ALL & bulk collect to improve the performance
    b) Divide table data into multiple chunks & execute parallel batches (around 10) to insert the data
    5) Validate pre & post counts to verify the success of migration
    Is there any other better way?
    Regards,
    Sandeep

    How to move only subset of data from a partiular table by using transportable tablespace?
    E.g. SUB table using SMP_SUB tablespace contains subscriber data in source database.
    The indexes defined on SUB table are under SMP_IDX_SUB tablespace
    The subscribers data can be categorized by different regions, say region_id column. Then how to move data & indexes of SUB table from source db to destination db?
    any specific example would be helpful.

  • How to move songs in one playlist from one mac to another?

    I am running the current version of  iTunes on my MacPro and my MBAir, both of which are authorized computers in my iTunes account.  I would like to copy the tunes in one playlist on my MacPro to my MBA, so that I can take them on the road.  Some of the songs are purchased from the iTunes store, and some have been ripped in from CDs I own.  I have found numerous links explaining how to move an entire iTunes library to a new computer.  But, I simply want to copy a few files from one Mac to another so that I can play them on either machine.  How do I do this?  Thanks!

    There are no shortcuts with the way your iTunes libraries are set up. You'll just have to go to each individual song, use "Show in Finder" to locate the actual file and copy and paste them to your other computer's iTunes.
    What I suggest for someone who has multiple computers is to designate one computer to store all of your iTunes content and use the Home Sharing feature to stream to the other computer. iTunes was not designed for an individual that has multiple computers.

  • How to move worksheet saved on database from one instance to another?

    Hi Every one,
    How to move worksheet or workbook saved on database from Discoverer plus from one instance to other instance?
    Is there any way to save a workbook or work sheet on to local drive from discoverer plus.?
    Thanks
    santhosh

    Hi,
    You have 2 options: use Discoverer Administrator to export/import the workbook; or use Discoverer Desktop to save the workbook to the local drive.
    You cannot save a workbook to the local drive using Discoverer Plus.
    Rod West

  • How to move all or partial data from Mac to an external hard disk?

    Hei,
    I need to learn how to move the movies/projects/events from mac hard drive to another external hard drive.
    So basically, I have always imported all events from my video camera (the original clips) to iMovie located in my MacBook Pro hard drive. But after videoing for one year, the hard disc is starting to get full, and I cannot continue using only the laptop's hard drive.
    So I would like to move part OR all of my iMovie related stuff to another external disk drive (connected with USB wire). How do I do that? Is it possible to have some events located in Mac's own hard drive, and some clips/projects in the external hard disk? How to arrange all this?
    I know that "projects" are linked to the original event clips, so if I would be able to export some part of my iMovie data to the external hard drive, I should export both, for example, everything from the same year (the events) which is linked to the projects that are using those data.
    Any tips would be greatly appreciated.

    ok First with IM9, you can easily move stuff around. Here are some lessons learned from my experience managing projects across 6 different drives.
    1. All Drives must be formatted macos extended journaled
    2. The large terabyte drives are great for long term storage of events
    3. When you are working on a project, if possible, try to move the clips the current clips you will need to your internal hard drive. This is only necessary if you care about any time machine back ups.
    4. I have also worked on project straight from the external drives. I also use portable drives such as WD passports. These are small 500 gig drives that can travel with you. I have three of those. LOVE THEM.
    5. One way to move projects and clips and keep things organized is to move the project using command drag. It will ask, do you want to move just the project or project and clips. Then voila all clips and project are then moved to that drive!
    6. REMEMBER...MOVE WITHIN IMOVIE using COMMAND Drag. NEVER EVER USE THE FINDER. This is for both projects and events. Using the Command Key will ensure the projects are moved and not just copied!
    7. Last but not least, if you have changed the dates of events using change date function in imovie....For some reason, there is a bug. It inconsistently will change the date. Don't know why and have reported the issue, but it is still not fixed!
    But its still a great little app!

  • How ERP Movement Type is being determined from EWM

    Hello,
    Could you explain me, how ERP Movement is being determined from EWM goods movement posting?
    For example, when I upload the stock, ERP movement is determined at 561. When we do, Goods Receipt, ERP movement is determined as 101. How this movements are controlled or being determined.
    Regards,
    Sathish

    Hi,
    there are some systemtables, starting with "/SCWM/TIMBWA*", which are being used for the determination.
    Brgds
    Juergen
    Want to learn EWM?
    Check for EWM courses @ https://training.sap.com/curriculum/scm_ewm
    Get a SAP Learning Hub Subscription: https://training.sap.com/shop/learninghub

  • How to Move or Copy the Tables from One Database to Another Database ?

    HI,
          Can any one help me on this, How i can move or copy the tables from one database to another database in SQL server 2005 by using SQL query. Hope can anyone provide me the useful and valuable response.
    Thanks
    Gopi

    Hello,
    Maybe these links help you out
    http://www.microsoft.com/downloads/en/details.aspx?familyid=56E5B1C5-BF17-42E0-A410-371A838E570A&displaylang=en
    http://www.suite101.com/content/how-to-copy-a-sql-database-a193532
    Also, you can just detach the database make a copy and move it to the new server.

Maybe you are looking for