Jump to content

Recommended Posts

Posted

Hello All,

It has been a long time since I posted, role changes etc involving work and I finally am back to modifying a program I write in AutoIt that has AD integration. I am at a point where we are modifying our structure where I am validating users access via what Distribution List they belong to in our AD OU's. What I have run into is the OU is a sub OU of a sub OU now. Meaning: CN=team, OU=DL, OU=Groups, DC=business.com(working), is now CN=Team, OU=SubDL, OU=DL, OU=Groups, DC=business.com (Not working).  Just curious if the AD functionality should be able to read it or maybe I am missing something?

 

ElseIf _AD_IsMemberOf("CN=Team,OU=Distribution Lists,OU=Groups,DC=business,DC=com", $sFQDN_User) Then
#works for primary Distro

ElseIf _AD_IsMemberOf("CN=Team,OU=SubDL,OU=Distribution Lists,OU=Groups,DC=business,DC=com", $sFQDN_User) Then
#fails for subOU of DL

How I am accessing AD to get the information:

_AD_Open()
    Global $aUser = _AD_GetObjectsInOU("", "(&(objectCategory=person)(objectClass=user)(samaccountname=" & @UserName & "))", 2, "ADsPath,Displayname,distinguishedName")
    Global $sDisplayName0 = $aUser[1][1] ; Displayname
    ;MsgBox(0,"", $sDisplayName0)
    If StringLeft($sDisplayName0, 2) = "9-" Then
        $Displaynamestring = StringTrimLeft($sDisplayName0, 2)
        $Displaynamestring1 = StringTrimRight($Displaynamestring, 6)

The error code generated is a 1 with a 0 extended. I assume it is because it cannot find the SubOU.

 

Thanks for any assistance.

Posted

@error = 1 for _AD_IsMemberOf means that the specified group does not exist.
You are sure the group exists and the FQDN is written correctly?

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

This was something you helped me write back in the day, only recently did our distribution lists jump 1 more sub OU as well as we shifted to a multitenant domain where some are suggesting certain OUs are not able to seen in others. Our DNS team doesn't think thats the issue that maybe I am writing the OU tags incorrectly, which I suspect might be the case as I am able to access the OU in Groups but not the next 1 under Distribution Lists. In theory though shouldn't CN=name, OU=Subsubou, OU=Subou, OU=Groups, DC=Comp.com be accurate?

Posted

Are there any special characters in the FQDN? This are:

  Quote

"\/#,+<>;=

Expand  

 

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

When you run _AD_Example_GetOUTreeView.au3 do you see both OUs?

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted (edited)

I am running it now waiting for it to finish populating my information.

 

My concern though is that I can get to a subOU already but not 1 more down. That is what is causing my concern :/

 

EDIT

 

I confirmed the subOU is listed in the _AD_Example_GetOUTreeView.au3

Edited by tweakster2010
Posted

Great! So lets do a simple check:

#include <AD.au3>
_AD_Open()
Global $iReturn = _AD_ObjectExists("your FQDN goes here")
MsgBox(0, "Result", "Return value=" & $iReturn & ", @error=" & @error & ", @extended=" & @extended)

 

My UDFs and Tutorials:

  Reveal hidden contents

 

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
×
×
  • Create New...