Announcement

Collapse
No announcement yet.

DSQUERY with Multiple parameters

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

  • DSQUERY with Multiple parameters

    Anyone know if it's possible to use DSQUERY with multiple parameters. I want to query AD with 15 accounts and return when they expire. I have tried the following:

    dsquery user domainroot -name "username1, username2" | dsget user -acctexpires
    dsquery user domainroot -name username1 username2 | dsget user -acctexpires
    dsquery user domainroot -name username1; username2 | dsget user -acctexpires

    Reading the DSQUERY help it states the followin:

    "If you supply multiple values for a parameter, use spaces to separate the values (for example, a list of distinguished names).
    " but it doesn't work

    Michael
    Last edited by m80arm; 21st February 2007, 03:22.
    Michael Armstrong
    www.m80arm.co.uk
    MCITP: EA, MCTS, MCSE 2003, MCSA 2003: Messaging, CCA, VCP 3.5, 4, 5, VCAP5-DCD, VCAP5-DCA, ITIL, MCP, PGP Certified Technician

    ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

  • #2
    Re: DSQUERY with Multiple parameters

    May be you can use vb to create a loop for processing each different user?
    http://forums.petri.com/showthread.p...ed=1#post59310
    (second script)

    \Rem

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment


    • #3
      Re: DSQUERY with Multiple parameters

      Rems,

      Cheers for that - Sorta gave up on the idea. Just read over it and realised I left my user ID's in. By the time you read this I've probably editied it out

      Michael
      Michael Armstrong
      www.m80arm.co.uk
      MCITP: EA, MCTS, MCSE 2003, MCSA 2003: Messaging, CCA, VCP 3.5, 4, 5, VCAP5-DCD, VCAP5-DCA, ITIL, MCP, PGP Certified Technician

      ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

      Comment


      • #4
        Re: DSQUERY with Multiple parameters

        If you put the account names in a file (one per line), you can do something like:
        Code:
        for /f %i in (accounts.txt) do @echo %i: && dsquery user -samid "%i" | dsget user -acctexpires
        Guy Teverovsky
        "Smith & Wesson - the original point and click interface"

        Comment


        • #5
          Re: DSQUERY with Multiple parameters

          Guy,

          You da man - worked a treat!!

          Wish I was a script monkey

          Thanks again

          Michael
          Michael Armstrong
          www.m80arm.co.uk
          MCITP: EA, MCTS, MCSE 2003, MCSA 2003: Messaging, CCA, VCP 3.5, 4, 5, VCAP5-DCD, VCAP5-DCA, ITIL, MCP, PGP Certified Technician

          ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

          Comment

          Working...
          X