Please Read: Significant Update Planned, Migrating Forum Software This Month

See more
See less

dsmove problem

  • Filter
  • Time
  • Show
Clear All
new posts

  • dsmove problem

    what i'm trying to do is query my ad for all disabled users and then move them to an existing ou. However i can't seem to get dsquery and dsmove towork together.

    I've tried the following command the out put is given below.

    dsquery user -disabled -limit 7000 | dsmove -newparent "ou=te

    dsmove failed:`CN=zsiddiq,OU=Disabled Users,DC=engr,DC=DC,DC=SU,DC=COM' is an
    unknown parameter.
    type dsmove /? for help.

    ok so i thought maybe i'll out the settings to a file and input it back in.

    dsmove -newparent "ou=test,dc=engr,dc=dc,dc=su,dc=com" < test2.txt

    move failed:`CN=avillena,OU=Disabled Users,DC=engr,DC=dc,DC=SU,DC=COM' is a
    unknown parameter.
    pe dsmove /? for help.

    however if i pipped in 1 value at a time it works. i.e my test2.txt had 1 entry, and i read the file in , it works.

    so is then that dsmove only works for 1 move at a time? I can't do mass lists?

    any one know how i can write a loop to keep doing this?

    i basically want to scan all my cn=users for disabled accounts,move them to an ou=test

    i thought this would do it..

  • #2
    Re: dsmove problem

    ok i figured out a hack and slash way

    advanced VB users please don't throw rocks at me. I don't know vbscript so i did it in dos scripting:

    here's what i did:

    @echo Automated scripting

    dsquery user "cn=users,dc=engrnt,dc=ad,dc=scu,dc=edu" -disabled -limit 7000 > disabledlist.txt
    sort disabledlist.txt > sortedlist.txt

    For /f "tokens=* delims=" %%a in (sortedlist.txt) Do (
    @echo %%a
    @echo dsmove %%a -newparent "ou=test,dc=engrnt,dc=ad,dc=scu,dc=edu" >> executemove.bat)

    so essentially i populated a list of disabled users from dsquery , wrote it to a file, sorted it (i don't know why, but i thought it would be a nice to have everything sorted a-z).
    then used a for loop on the file and wrote a dsmove command to a batch file. Let that run over night and all my users should have moved.

    i'm sure there are vbscripts that do this for half the number of lines and probably way more efficient, but i didn';t know how.