Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Problems with DSQUERY | DSMOVE command

Posted on 2007-12-03
3
Medium Priority
?
1,983 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
Microsoft Office 365 is a subscriptions based service which includes services like Exchange Online and Skype for business Online. These services integrate with Microsoft's online version of Active Directory called Azure Active Directory.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

647 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