How-to move objects (users) from one ou to another using Powershell and an XLSX

Hi all,
I have a spreadsheet that has headers. I need to move all of the objects on this exception report to the proper OU (all going to the same OU).
The header that validates the need to move is called "Display Name".
The process now is as follows.
1) Copy displayname
2) Open AD search
3) enter display name in find box
4) locate object
5) right click object in results and click move.
6) move to the OU "Home.test.com/uk Online/Users OU/Business Process"
--- How can i use Import-CSV to automate this process?
Thanks for any help, there is about 4K lines on this sheet and it normally takes about 25 days of "busy work" to accomplish this, then 5 days later I have to re-run the report and start over.
Josh
Josh Borges

Hi Josh,
This assumes that you can save your file as an actual CSV file:
$skippedUsers = @()
Import-Csv .\userList.csv | ForEach {
$displayName = $_."Display Name"
$user = Get-ADUser -Filter "DisplayName -eq '$displayName'" -Properties DisplayName
If ($user.Count) {
$skippedUsers += $displayName
Else {
$user | Move-ADObject -TargetPath 'OU=Business Process,OU=Users OU,OU=uk Online,DC=home,DC=test,DC=com' -WhatIf
If ($skippedUsers) { Write-Host 'The following users could not be moved automatically:' -ForegroundColor Red ; $skippedUsers }
Do you have to use the display name property? That's not guaranteed to be unique, so you might run into problems. The script above will not attempt to move the user if more than one is returned by the command.
EDIT: I've also added -WhatIf to Move-ADObject. Now the command won't actually move your users, it will just tell you about it. Remove it if you're happy with the output.
Don't retire TechNet! -
(Don't give up yet - 12,420+ strong and growing)

Similar Messages

  • How to move multiple tracks from one location to another on HD and keeping iTunes updated?

    Hi all
    I'd like to move/re-arrange some subdirectories of my iTunes' main folder and I'd like to keep iTunes library updated without broken links without needing to re-imports the moved albums/tracks. Is there any method to do this? Even with the help of some utility or app?
    thanks in advance!
    luca

    iTunes works this way.  You add a file. It makes a note of its location and metadata stored in the file and adds this to its own library database. 
    Note: All my answers are with reference to iTunes 7.5  (yes, 7.5). I've stopped trying to keep up with Apple's newer stuff which is why I rarely come here anymore.
    Answers to your specific questions.
    1&2)  I think I have in the past copied a file with the identical name over an existing file and iTunes was fooled into thinking it was the original file.  However, it didn't update the metadata in its own database until I highlighted the file briefly in a playlist.  This causes the original file to be re-read.  The same thing happens if I use a third party metadata editor to change the metadata in a file.  iTunes will continue to display the old data until I briefly select the file in a playlist or it starts to play the file.
    You can, by the way, add two files with the identical name (but in two different folders obviously) and iTunes will add them both as individual entries, even if the metadata is identical.
    3)  I don't have iTunes Match obviously (I can't even see the Store anymore with iTunes 7).  My third hand understanding is it won't do anything to your original files.  If it finds a match it will automatically download the match to your iTunes folder as if you had all the preferences settings set to use it normally.  I'm guessing you will then have two files for that track and you'll need to work on cleaning up the lesser quality one unless you want to just leave it.  Again, can't speak from experience.
    I have both preferences options de-selected and don't want to select them to test my reply. I don't want iTunes to do either because I have media organized by kind and source over two internal hard drives and 3 partitions.  I 100% manage my media manually and have always done it that way.  I think option 2 has iTunes restructure your folders according to album and artist.  I deselected both because i didn't want to constantly be fighting iTunes in its attempt to organize things how it wanted.
    If you're going to manage your media manually then you need to understand how iTunes works in detail and be willing to stay on top of it.  iTunes is designed to do everything on its own so people don't have to worry about things.  By unclicking its default preferences or moving files yourself in Finder or using a script to do so you are also figuratively clicking a button that says, "Okay, I know what I am doing and iTunes works."  Normally rule #1 with iTunes is never, never move a file to a different location in Finder and you'll see a lot of posts here from people who have "lost" items becaause they moved a folder or renamed it.  Maybe iTunes behaves differently when you deselect those preferences because I do this all the time and iTunes can track it as long as I don't move it to a different volume/drive.  I am very careful not to lose things or make duplicates, and of course I back up my computer before any major editing.

  • How to move a report from one account to another account

    Dear all ,
    How to move a reports from one account to another account.
    These are reports sent automatically. Unfortunately, I do not know where to find them and how to export to another account.
    Puru

    Hi,
    You can use the Transaction SCC1 to move the data from One Client to Another Client for a Client dependent table.
    The data should be present in a Transport and you can import to Transport to any client using SCC1.
    Contact the Basis team to know how to use SCC1.
    Regards,
    Aj

  • How to move SQL database from one location to another location i.e. from C' drive to D' drive

    Hi, How to move SQL database from one location to another location i.e. from C' drive to D' drive ? please share some link.
    Thanks and Regards, Rangnath Mali

    Hi Rangnath,
    According to your description, my understanding is that you want to move databased from C drive to D drive.
    You can detach Database so that the files become independent, cut and paste the files from source to destination and attach again.
    There are two similar posts for your reference:
    http://mssqltalks.wordpress.com/2013/02/28/how-to-move-database-files-from-one-drive-to-another-or-from-one-location-to-another-in-sql-server/
    http://stackoverflow.com/questions/6584938/move-sql-server-2008-database-files-to-a-new-folder-location
    Best Regards,
    Wendy
    Wendy Li
    TechNet Community Support

  • OpenScript: 1.     How to move the scripts from one location to another location. in OpenScript; Copy, paste or Import, export

    How to move the scripts from one location to another location. Copy, paste or Import, export

    Both way you can do.. Difference is - if you copy paste to another folder script dependencies will not move with the same( ie Assets added), whereas if you export and import the script all dependencies will be correlated automatically

  • How to move an instance from one activity to another

    Hi all,
    Is it possible to move an instance from one activity to another using an external process? Is it possible to do this with PAPI and pass parameters to the instance in order to determine the instance's flow?
    Regards

    Yes it is possible using PAPI. I have just used PAPI to create instances . I have not tried the requirement which you want. But as per my knowledge it can be done.
    Good Luck
    Right Chord

  • How do i transfer music from one ipod to another using itunes

    how do i transfer music from one ipod to another using itunes

    Welcome to the Apple Community.
    There is more than one way, but to get it all on all devices, connect the first device to iTunes and choose to transfer the music from the device from the file menu. Once everything is in iTunes connect the second device, select the device in the device list, navigate to the music tab and check the content you wish to sync, click apply/sync.

  • How to copy List item from one list to another using SPD workflow using HTTP call web service

    Hi,
    How to copy List item from one list to another using SPD workflow using HTTP call web service.
    Both the Lists are in different Web applications.
    Regards, Shreyas R S

    Hi Shreyas,
    From your post, it seems that you are using SharePoint 2013 workflow platform in SPD.
    If that is the case, we can use Call HTTP web service action to get the item data, but we cannot use Call HTTP web service to create a new item in the list in another web application with these data.
    As my test, we would get Unauthorized error when using Call HTTP web service action to create a new item in a list in another web application.
    So I recommend to achieve this goal programmatically.
    More references:
    https://msdn.microsoft.com/en-us/library/office/jj164022.aspx
    https://msdn.microsoft.com/en-us/library/office/dn292552.aspx?f=255&MSPPError=-2147217396
    Thanks,
    Victoria
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • HT4527 I am trying to transfer music files from one PC to another using homeshare and although I can view the music as a shared folder I cannot initiate the "import" process.  I have iTunes 11.0.1.12 on both computers so the help screenshots do not help a

    I am trying to transfer music files from one PC to another using homeshare and although I can view the music as a shared folder I cannot initiate the "import" process.  I have iTunes 11.0.1.12 on both computers so the help screenshots do not help as such

    Then stop trying to use HomeShare and use one of the other options listed in the document from which your question was posted.

  • How can I move particular users from one client to another client

    Hi, I am trying to find a way to move few or many user from one client to another. Is there a transaction available or program to move them. e.g. there is a SCC1 available to move transport only from one client to another without going through TMS.
    Is there any trick available ?
    thnx in advance

    closing this one. thnx

  • How do I move a user from one computer to another?

    Our company has a volume license for CS4 and I am trying to move an employee from one MAC to another MAC.  When she logs into new MAC and tries to open InDesign or Creative Cloud they both crash.  The other programs are opening up fine.  The new MAC has a user that all CS4 programs work fine as well. 

    CS4 is from LONG before the Cloud... but recent messages that are about Cloud programs indicate that the Apple "migration tool" does not work... you need to do a new install & activation
    For your problems with new Cloud programs, try the link below
    Link for Download & Install & Setup & Activation problems may help
    -Online Chat http://www.adobe.com/support/download-install/supportinfo/

  • How to move iMovie project from one computer to another

    I have been working on an iMovie 09 project on my desktop at home.
    Now I want to work on the same project on my computer at work.
    How can I move the project from one computer to another?   What I've already tried was to make a duplicate copy of the project and then use a thumb drive to move that to another computer.   It didn't work.
    Thanks for your help.

    Hello James Snedeker,
    After reviewing your post, it sounds like you want to move a file to another disk. I would recommend that you read this article, it may be able to help the issue.
    iMovie: How to Save Projects to Another Hard Disk
    To copy an iMovie project to another disk:
    1. Quit iMovie if it is open. 
    2. Locate the project folder in the Finder.
    3. Drag the project folder to the other disk.
    Note: You must move the complete project folder, intact, to the other disk in order to successfully copy the project. The project folder has the same name as the project listed in the iMovie window. This folder includes the iMovie project file, as well as a Media folder, which contains all of the clips associated with this project. If you don't copy all of these items, the project may no longer be readable in iMovie.
    Once you have copied the project, try opening it in iMovie to ensure that it copied to the other disk successfully.
    Thanks for using Apple Support Communities.
    Have a nice day,
    Mario

  • Trying to move a users from one database to another gives error

    When I try moving a user from one database to another I get an error, but one some PC's installed with EMC, gives no problems. So what could the the issue here, I tried googling, but came out without any solution. Exchange 2010 sp3, EMC on Windows 7 pc.
    The error message is:
    The move request for user is invalid. The user's Active Directory identity doesn't match the mailbox identity in the
    move request. It was running command "Get-MoveRequestStatistics -identity.....

    Is this 1 specific mailbox or any mailbox? Things to consider:
    Make sure that your Exchange management tools are running the same build as your Exchange server (2010 SP3 RUx). 
    Try using the Exchange Management Shell and typing Set-ADServerSettings -ViewEntireForest $True
    You might need to use the RUN AS ADMINISTRATOR when open Exchange tools
    Try running Clean-MailboxDatabase against each DB -
    http://technet.microsoft.com/en-us/library/bb124076(v=exchg.141).aspx
    Review and then Remove old move requests
    Try mailbox repair request -
    http://technet.microsoft.com/en-us/library/ff625221(v=exchg.141).aspx

  • How do i transfer songs from one iphone to another using bluetooth

    how do i transfer songs from one iphone to another iphone using bluetooth

    You don't. Sync via iTunes to PC/Mac, then to other device.
    Otherwise people could "share" all their purchased music.

  • How to move Profit centers from one hierarchy to another.

    Hi All - In Standard hierarchy in our Profit center accounting, we have in KCH6N as below and doing posting to these successfully.
    1. C1470 - 000001470 Profit center
    2. C1472 - 000001472 Profit center
    Now for some Business reason, we need to temporarily move above said profit centers in their hierarchy to another one C1410. So Users could post a journal entry and then move the profit centers back to their current location.
    After we make the change, It should be
    C1410 - 000001470 Profit center
    C1410 - 000001472 Profit center
    Can you please suggest me how to move the Profit centers from one hierarchy to another. Can you please let me know how to make this change.
    Thanks

    Hi Hoysala,
    This is not the best practice, to change profit center hierarchy node to another node, just for the sake of JV.
    If you have to allocate a cost/revenue from one cost center/profit center to another, I would advise you to use manual allocation/distribution  process, as per your business reason (Profit Center Allocation/Cost Center Allocation), rather than changing hierarchy nodes.
    You can use 3KE5-Execute Actual Assessment and 4KE5-Execute Actual Distribution from Profit Center 1470/1472 to the profit center under node C1410, without moving profit center from one node to another.
    http://veritysolutions.com.au/2012/07/03/overhead-allocations-in-sap-new-gl/
    Regards
    Javed

Maybe you are looking for