Sign in to follow this  
Followers 0
eatfishdk

How to see what ou the computer is a member of?

3 posts in this topic

Hi..

I don't know much about working with domains and autoit.. I've seen the ADfunctions.au3 file but have no idea if it does this..

I just need a way have the script to return what OU the machine is a member of.. (the entire structure, ex. domain\site1\room3 or something like that)..

Martin

Share this post


Link to post
Share on other sites



Hi eatfishdk,

does this bring the information you need? Replace xxxxx with the name of your computer.

#include <adfunctions.au3>
#include <array.au3>

$ou = "DC=domain,DC=top-level-domain"               ; Root of your AD ex. DC=microsoft,DC=com
Dim $Out

_ADGetObjectsInOU($Out, $ou, "(&(objectClass=computer)(cn=xxxxx))", 2, "distinguishedName")
_ArrayDisplay($Out)

AD Explorer gives you a good overview what fields you can query from AD: http://technet.microsoft.com/en-us/sysinte...s/bb963907.aspx

This site is a good start for how to build LDAP queries: http://www.petri.co.il/ldap_search_samples...nd_exchange.htm

HTH

Thomas


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hi eatfishdk,

does this bring the information you need? Replace xxxxx with the name of your computer.

Yes! Thanks! That and along with some array functions turns this in to exactly the output I need (machinename\ou\ou\domain) in text.

Oh, and thanks for the links, these are gonna help me alot understanding this Active Directory thingy... :-D

Martin (from Denmark)

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