Announcement

Collapse
No announcement yet.

possible to pipe dsquery result into dsrm?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • possible to pipe dsquery result into dsrm?

    not sure if this should be under here or the AD forum. I apologize if it's in the wrong place and kindly ask the moderator to move this.

    One issue i'm having is i want to pipe dsquery results to dsrm. I want to be able to remove accounts based on username and not their dn. As far as i can tell from various sites, dsrm only takes the forum of "CN=,DC=,..." or "OU=,DC=..". that is why i thought initially i could do this:


    dsquery user "DC=my,DC=doman,DC=com" -samid dperry | dsrm

    but when i run this all i get is just the screen where it shows info on the dsrm command.

    So what i ended up doing was a 2 step process.

    dsquery user "DC=my,DC=domain,DC=com" -samid dperry | dsmove -newparent "OU=Deleted User,DC=my,DC=domain,DC=com"

    ** i first isolate and move the account i want to an OU called "Deleted User"

    dsrm -noprompt -subtree -exclude -c "OU=Deleted User,DC=my,DC=domain,DC=com"

    ** i then issue the dsrm command on the OU and delete all the contents but not the OU


    Now this works, but i was hoping to do everything in a single step and not have to move things around.

    Thanks,

  • #2
    Re: possible to pipe dsquery result into dsrm?

    It looks to me that this is more related to AD, so i've moved it.
    I think Guy can help you out with is...
    Marcel
    Technical Consultant
    Netherlands
    http://www.phetios.com
    http://blog.nessus.nl

    MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
    "No matter how secure, there is always the human factor."

    "Enjoy life today, tomorrow may never come."
    "If you're going through hell, keep going. ~Winston Churchill"

    Comment


    • #3
      Re: possible to pipe dsquery result into dsrm?

      Ahhh ! another one bites the dust

      Here is a workaround with an example:

      Code:
      C:\>for /f %i in ('dsquery user -samid user1* -limit 0') do @dsrm %i -noprompt
      dsrm succeeded:CN=user1,OU=Test,DC=gute,DC=local
      dsrm succeeded:CN=user10,OU=Test,DC=gute,DC=local
      dsrm succeeded:CN=user100,OU=Test,DC=gute,DC=local
      dsrm succeeded:CN=user11,OU=Test,DC=gute,DC=local
      dsrm succeeded:CN=user12,OU=Test,DC=gute,DC=local
      dsrm succeeded:CN=user13,OU=Test,DC=gute,DC=local
      dsrm succeeded:CN=user14,OU=Test,DC=gute,DC=local
      dsrm succeeded:CN=user15,OU=Test,DC=gute,DC=local
      dsrm succeeded:CN=user16,OU=Test,DC=gute,DC=local
      dsrm succeeded:CN=user17,OU=Test,DC=gute,DC=local
      dsrm succeeded:CN=user18,OU=Test,DC=gute,DC=local
      dsrm succeeded:CN=user19,OU=Test,DC=gute,DC=local
      Guy Teverovsky
      "Smith & Wesson - the original point and click interface"

      Comment


      • #4
        Re: possible to pipe dsquery result into dsrm?

        sorry i was on vacation.

        Thanks!!! this worked for me.

        Comment

        Working...
        X