?
Solved

Problems with DSQUERY | DSMOVE command

Posted on 2007-12-03
3
Medium Priority
?
1,942 Views
Last Modified: 2010-04-21
I am attempting to move disabled users from one ou to another using the following command and I keep getting an error.

dsquery user -disabled "ou=contractors,dc=company,dc=corp,dc=local" | dsmove -newparent "ou-disabled contractors,dc=company,dc=corp,dc=local"

dsmove failed:`CN=Smith\, John,OU=Contractors,DC=COMPANY,DC=Corp,DC=Local' is an unknown parameter.

It seems that dsmove is reading the "\" as a backslash instead of using it as an escape character. as required according to dsmove help.

Can someone explain to me how to correct this problem, or perhaps a better way of performing this task?
0
Comment
Question by:dbarker2
[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
3 Comments
 
LVL 85

Accepted Solution

by:
oBdA earned 1000 total points
ID: 20396698
No, that's simply a bug in dsmove; it won't read more than one line fom stdin.
Try the following workaround in a batch file (it will currently only echo the dsmove command; remove the capitalized ECHO to run it for real):

for /f "delims=" %%a in ('dsquery user -disabled "ou=contractors,dc=company,dc=corp,dc=local"') do (
  ECHO dsmove %%a -newparent "ou-disabled contractors,dc=company,dc=corp,dc=local"
)

Open in new window

0
 
LVL 26

Expert Comment

by:Farhan Kazi
ID: 20396716
Try this:

Click Start -> Run -> Cmd.exe -> OK

FOR /F "delims=*" %u IN ('DSQuery User -disabled "ou=contractors,dc=company,dc=corp,dc=local"') DO @DSMove %u -NewParent "ou-disabled contractors,dc=company,dc=corp,dc=local"

Hope this helps!
Farhan
0
 
LVL 3

Author Closing Comment

by:dbarker2
ID: 31412364
Thanks oBda, very helpful.
0

Featured Post

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
Group policies can be applied selectively to specific devices with the help of groups. Utilising this, it is possible to phase-in group policies, over a period of time, by randomly adding non-members user or computers at a set interval, to a group f…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Suggested Courses

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