Sign in to follow this  
Followers 0
TomasOMalley

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

2 posts in this topic

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.

Share this post


Link to post
Share on other sites



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)

Share this post


Link to post
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
Sign in to follow this  
Followers 0