Jump to content

Get all Computer from an "OU" with AD.au3


Go to solution Solved by TomasOMalley,

Recommended Posts

Hi, I'm trying to do something.

I want to get all computers présents in an OU of my domain ...

I use AD.au3 but i don't find the simple code to obtain that ?

exemple : from

"OU=computers,OU=TESTS,DC=MyDomain,DC=com"

I want to get

"Computer1|Compter2|Mycomputer|......."

thanks for your help.

Link to comment
Share on other sites

  • Solution

Ok, i find, so i give you the code.

Thanks a lot :

Global $test = ""


                            _AD_Open()
                            Global $sOU = "OU=TEST,OU=RETEST,DC=domaine,DC=net"
                            Global $aResult = _AD_GetObjectsInOU($sOU, "(name=*)", 2,"sAMAccountName,distinguishedName,displayname")
                            For $i = 1  To $aResult[0][0]
                                $test = $test&$aResult[$i][0]
                            sleep (100)
                            Next
                            _AD_Close()
MsgBox (0,"",$test)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...