Bulk Users Moved to New OU--Need Help with Users not Moved RRS feed

  • Question

  • Please understand I do not have a full understanding of scripting. We use the following to move Users to new OU: 

    Import-csv "C:\moveuser.csv" | % {Move-ADObject $(Get-ADUser $_.User) -TargetPath $_.NewOU -Confirm:$False

    This works great. Problem is when we do a bulk move and some users are not able to be moved it is displayed in red indicating user which user was not moved.

    This is what I am asking:

    1: is to have the command run normally but export the users that could not be moved to csv 

    2:(Optional) display the User Object path in csv.

     I do not know how to perform the logic of telling what to do with the users not moved. Please any thoughts or ideas.
    • Moved by Bill_Stewart Saturday, June 24, 2017 6:37 PM Unanswerable drive-by question
    Thursday, April 27, 2017 3:55 PM

All replies