Results 1 to 5 of 5

Thread: dsquery pipe to dsmove

  1. #1
    Join Date
    Jan 2004
    Posts
    18

    dsquery pipe to dsmove

    I’m running a Windows Server 2003 in my Office with a DC in my Domain. I was trying to run the following dsquery on the said DC by its not working:

    dsquery computer cn=computers,dc=na,dc=zzz,dc=com -name xxxtest*|dsmove
    -newparent "ou=usa,ou=il,ou=southside,ou=computers,dc=na,dc=zzz,dc=com"
    You can see there I pipe the results of the dsquery to a dsmove command but don’t know why its not working. However the dsquery command is working good on its own, it is also able to find and return the expected result but gives me problem when trying to pipe the dsquery to a dsmove. Everytime it ends up saying “the computer object cannot be found.”


    Somebody please help.

  2. #2
    Join Date
    Sep 2004
    Posts
    136

    Re: dsquery pipe to dsmove

    There seems to be some problem in your dsquery. The proper context for dsmove is as follows:

    dsmove.exe "CN=%1,OU=aaa,DC=AA,DC=BB,DC=com" -newparent
    OU=bbb,DC=AA,dc=BB,dc=com

  3. #3
    Join Date
    Sep 2004
    Posts
    154

    Re: dsquery pipe to dsmove

    Hello HenrikK. You need to add a space before the redirection. Which should be like this:

    dsquery computer cn=computers,dc=na,dc=zzz,dc=com -name xxxtest* |dsmove
    -newparent "ou=usa,ou=il,ou=southside,ou=computers,dc=na,dc=zzz,dc=com"

    Hope it helps. let me know the results.

  4. #4
    Join Date
    May 2008
    Posts
    1

    Another aproach

    I know almost nothing about vbscript but I love my .bat files. Here's what I came up with:

    --start--

    @echo off
    :again
    dsquery computer -limit 1 cn=computers,DC=vprodemo | dsmove -new parent ou=validation,dc=vprodemo
    if errorlevel 0 goto again

    --end--

    this moves the computer accounts one at a time. Once they are all moved dsmove fails and the .bat ends.

  5. #5
    Join Date
    Feb 2010
    Posts
    1

    Re: dsquery pipe to dsmove

    so here's the problem. When DSQUERY pipes the output to DSMOVE, it is failing to put the DN of the found object in quotes.

    that's why you get an error
    dsmove failed:`CN=Tom Jones,OU=Blah,OU=ManagedUsers,DC=teach,DC=foo,DC=bar' is an unknown parameter.

    it should be sending "CN=Tom Jones,OU=Blah,OU=ManagedUsers,DC=teach,DC=foo
    t,DC=bar"

    The best way I've found to do this same iteration is, as others have suggested, by reversing it. Call DSMOVE and pull in the DSquery with a for command

    for /f "Tokens=*" %s in ('dsquery computer -limit 1 cn=computers,DC=vprodemo') do dsmove %s -newparent ou=validation,dc=vprodemo


    http://www.tech-archive.net/Archive/.../msg00568.html

Similar Threads

  1. Replies: 1
    Last Post: 11-11-2011, 04:46 AM
  2. Hybrid Silent Pipe alternative for Gigabyte GA-X58A-UD
    By Vrushabha in forum Hardware Peripherals
    Replies: 6
    Last Post: 09-08-2011, 10:22 PM
  3. How to use pipe between programs in C?
    By Harpreet Gaur in forum Software Development
    Replies: 5
    Last Post: 08-01-2010, 10:13 AM
  4. USB:Pipe not Opening!
    By sunwins in forum Software Development
    Replies: 2
    Last Post: 27-05-2009, 08:33 AM
  5. [Named Pipe] Redirection of STDIN and STDOUT
    By Shanbaag in forum Software Development
    Replies: 2
    Last Post: 24-04-2009, 03:53 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,717,385,368.79262 seconds with 16 queries