Announcement

Collapse
No announcement yet.

dsquery - multiple sites and OUs (Split from dsquery help)

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

  • dsquery - multiple sites and OUs (Split from dsquery help)

    Hello,

    I would like a little help, if it's possible.
    In my Active Directory, i have many OU that corresponding to different location.
    I have 3 main OU (APAC, EMEA and NCSA) and in these OU, there is many others that corresponding to different sites (Paris, London, Sofia, etc).

    My goal is to enumerate all inactives computer in these different OU.
    I use the commande DSQUERY with this command ( for 5 weeks):

    dsquery computer OU=MYCOMPANY,DC=DOMAIN,DC=ORG -inactive 5

    this command work great but the result is hard to use. for exemple, two different lines (in excel) :

    CN=PCNAME,OU=Laptops,OU=Computers,OU=MYSITE,OU=EME A,OU=COMPANY,DC=DOMAIN,DC=ORG
    CN=SERVERNAME,OU=Servers,OU=MYSITE,OU=EMEA,OU=COMP ANY,DC=DOMAIN,DC=ORG

    When i separate these lines in Excel (with the ,) , for the first exemple I have 8 columns, for the second i have 7 columns.
    The problem is that some columns does not corresponding each other, for exemple, in one column i will have EMEA and other i'ill have MYSITE. So I cannot use it.

    So, I'm going to use DSQUERY command on each SITE, and i want to obtain only the CN with the PCNAME, not the others. So i want to pipe my DSQUERY command with a DSGET command to only show the CN.

    Here is my question : is it possible to do this ?
    something like this
    dsquery computer OU=MYCOMPANY,DC=MYDOMAIN,DC=ORG -inactive 5 | DSGET XXXXXXX

    thanks for help
    Last edited by e_krus; 4th March 2008, 16:58.

  • #2
    Re: dsquery - multiple sites and OUs (Split from dsquery help)

    I guess you want only computer name, then this command will work for you

    dsquery computer OU=MYCOMPANY,DC=MYDOMAIN,DC=ORG -inactive 5 | DSGET computer -samid
    Cheers!!
    MCSE 2003,MCSA- Messaging 2003, VCP

    Comment


    • #3
      Re: dsquery - multiple sites and OUs (Split from dsquery help)

      Yo !!
      You're a good man it works great !!
      I wish you a good week

      Comment

      Working...
      X