dsmove, Object not found error

I am trying to move an object from one organizational unit to another, but it shows me an error.
The username is helloh, and the full name is Hello Hello.

I ran the batch code and it returned me :
C:\Users\admin\Desktop>security.bat
dsmove failed:CN=Hello,OU=Photography,OU=Students,DC=ec,DC=domain,DC=com:Di
rectory object not found.
type dsmove /? for help.

Open in new window


We are running Active Directory on Windows Server 2008 R2

The user.txt is:
Hello Hello

Open in new window

@echo off
For /f "tokens=1,2 delims=\" %%a in (user.txt) do dsmove "CN=%%a,OU=Photography,OU=Students,DC=ec,DC=domain,DC=com" -newparent OU=enrolled,OU=Students,OU=Users,DC=ec,DC=domain,DC=com

Open in new window

LVL 1
Robert DavisAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

oBdACommented:
Assuming the source and target OUs are correct, the parsing of the user.txt is incorrect.
If the user name is actually "Hello Hello", you may not separate the lines in user.txt into tokens.
Try this:
@echo off
For /f "delims=" %%a in (user.txt) do dsmove "CN=%%a,OU=Photography,OU=Students,DC=ec,DC=domain,DC=com" -newparent OU=enrolled,OU=Students,OU=Users,DC=ec,DC=domain,DC=com

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Robert DavisAuthor Commented:
The source and target OUs are correct. The same error still exists.
Ron MalmsteadInformation Services ManagerCommented:
You can also try using dsquery in conjunction with dsmove to ensure that your object sources are all correct.


dsquery user -samid "hello" | dsmove -newparent "OU=enrolled,OU=Students,OU=Users,DC=ec,DC=domain,DC=com"
xylogCommented:
Try removing the echo off line to see what is actually being output on the dsmove command line. Your for-command does not make any sense, you specify a delimiter \ but you do not show one in your example user.txt file. The way you show it %%a will resolve to "Hello Hello" and rather than just Hello.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.