Jump to content
Sign in to follow this  
Kovacic

AD.au3 | _AD_Open Error: 4 question

Recommended Posts

Greetings, here is what I am running into.. About my setup:

Computer 1: is on the domain, user account logged in is in local admin group and is a member of the domain, and has elevated AD abilities

Computer 2 (testing computer) logged in to by local admin account (not domain user), is on the domain.

when I execute this on computer 1, it returns the proper OU, on computer 2, it throws an Error 4 during the _AD_Open portion:

#include

dim $sAD_UserIdParam, $sAD_PasswordParam
_AD_Open( $sAD_UserIdParam = "ServiceProfile", $sAD_PasswordParam = "MyPassword")
If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended)

$fullou = (_AD_SamAccountNameToFQDN("DomainUserAccount"))
Msgbox(0, "Message", "This is Mikes OU:" & @CRLF & $fullou)
_AD_Close()

Keep in mind, I changed usernames and profiles to protect the innocent ;)

When I run this on computer 2, I get Error 4 which is:

4 - Creation of the RootDSE object failed. @extended returns the error code received by the COM error handler. Generated when connection to the domain isn't successful. @extended returns -2147023541 (0x8007054B)

Any thoughts?

Edited by Kovacic

C0d3 is P0etry( ͡° ͜ʖ ͡°)

Share this post


Link to post
Share on other sites

The way you specify userid and password is wrong. Should be:

#include <ad.au3>

Global $sAD_UserIdParam = "ServiceProfile", $sAD_PasswordParam = "MyPassword"
_AD_Open( $sAD_UserIdParam, $sAD_PasswordParam)
If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended)

$fullou = ("DomainUserAccount")
Msgbox(0, "Message", "This is Mikes OU:" & @CRLF & $fullou)
_AD_Close()

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-02-09 - Version 1.4.1.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

My only question is, if I changed

$fullou = (_AD_SamAccountNameToFQDN("mkovacic"))
Msgbox(0, "Message", "This is Mikes OU:" & @CRLF & $fullou)

to

$fullou = ("DomainUserAccount")
Msgbox(0, "Message", "This is Mikes OU:" & @CRLF & $fullou)

wont the result always just be DomainUserAccount ?

Because we are no longer using _AD_SamAccountNameToFQDN to pull the info

Edited by Kovacic

C0d3 is P0etry( ͡° ͜ʖ ͡°)

Share this post


Link to post
Share on other sites

$fullou = (_AD_SamAccountNameToFQDN("mkovacic"))
Msgbox(0, "Message", "This is Mikes OU:" & @CRLF & $fullou)

_AD_SamAccountNameToFQDN simply translates a SamAccountName to a Fully Qualified Domain Name (FQDN).

Most functions accept both formats so there is no need to translate it before calling a function.

If you want to get the name of the OU (Organization Unit) the user is assigned to, then _AD_SamAccountNameToFQDN is still needed.

But to get the OU you have to strip of the Relative Distinguished Name (RDN).

$sSamAccount = "DomainUserAccount"
$sFQDN = _AD_SamAccountNameToFQDN($sSamAccount)
$iPos = StringInStr($sFQDN, ",")
$sOU = StringMid($sFQDN, $iPos+1)
Msgbox(0, "Message", "This is Mikes OU:" & @CRLF & $sOU)
If the users CN (Common Name) contains a "," then another approach is needed to extract the OU.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-02-09 - Version 1.4.1.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

When I run this on computer 2, I get Error 4 which is:

4 - Creation of the RootDSE object failed. @extended returns the error code received by the COM error handler. Generated when connection to the domain isn't successful. @extended returns -2147023541 (0x8007054B)

Did you try to pass parameters $sAD_DNSDomainParam, $sAD_HostServerParam and $sAD_ConfigurationParam to _AD_Open?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-02-09 - Version 1.4.1.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

_AD_SamAccountNameToFQDN simply translates a SamAccountName to a Fully Qualified Domain Name (FQDN).

Most functions accept both formats so there is no need to translate it before calling a function.

If you want to get the name of the OU (Organization Unit) the user is assigned to, then _AD_SamAccountNameToFQDN is still needed.

But to get the OU you have to strip of the Relative Distinguished Name (RDN).

$sSamAccount = "DomainUserAccount"
$sFQDN = _AD_SamAccountNameToFQDN($sSamAccount)
$iPos = StringInStr($sFQDN, ",")
$sOU = StringMid($sFQDN, $iPos+1)
Msgbox(0, "Message", "This is Mikes OU:" & @CRLF & $sOU)
If the users CN (Common Name) contains a "," then another approach is needed to extract the OU.

The reason for that is, I am working on a small tool that will become part of a larger profiler script to get the users OU, strip out 'OU=users', grab everything to the right of it, then add 'OU=Computers' to make sure the computers are in the proper OU based on the user we are setting them up for.

Did you try to pass parameters $sAD_DNSDomainParam, $sAD_HostServerParam and $sAD_ConfigurationParam to _AD_Open?

​I did and it didn't seem to help.. is it because I am running it as local admin?


C0d3 is P0etry( ͡° ͜ʖ ͡°)

Share this post


Link to post
Share on other sites

If you just want to change the OU then you could use StringReplace

$sSamAccount = "DomainUserAccount"
$sFQDN = _AD_SamAccountNameToFQDN($sSamAccount)
$sNewOU = StringReplace($sFQDN, ",OU=users,", ",OU=Computers,")
Msgbox(0, "Message", "This is Mikes target OU: " & @CRLF & $sNewOU)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-02-09 - Version 1.4.1.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

​I did and it didn't seem to help.. is it because I am running it as local admin?

Could you try to specify the username as NetBIOS or UPN?

; * NetBIOS Login Name e.g. "<DOMAIN>\DJ"

; * User Principal Name e.g. "DJ@domain.com"


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-02-09 - Version 1.4.1.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

This is where I am so far and it seems im still getting the Error 4..

#include <ad.au3>

Global $sAD_UserIdParam = "ServiceProfile", $sAD_PasswordParam = "MyPassword", $sAD_DNSDomainParam = "DC=MyDomain,DC=COM", $sAD_HostServerParam = "MyDomainController"

_AD_Open( )
If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended)

$fullou = (_AD_SamAccountNameToFQDN("mkovacic"))
Msgbox(0, "Message", "This is Mikes OU:" & @CRLF & $fullou)
_AD_Close()

I verified on the same laptop if I log in with domain creds, I can actually pull the OU

Tried every naming convention I could... everything keeps pointing to that same error :/

Edited by Kovacic

C0d3 is P0etry( ͡° ͜ʖ ͡°)

Share this post


Link to post
Share on other sites

You have to pass the parameters to _AD_Open.

Please check the wiki for an example.

And check the $sAD_HostServerParam parameter and please set $sAD_ConfigurationParam as well.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-02-09 - Version 1.4.1.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

No. Funktion _AD_Open expects them as parameters!


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-02-09 - Version 1.4.1.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

ok, looks more like this now:

Global $sAD_UserIdParam, $sAD_PasswordParam, $sAD_DNSDomainParam , $sAD_HostServerParam

_AD_Open($sAD_UserIdParam = "ServiceProfile", $sAD_PasswordParam = "MyPW", $sAD_DNSDomainParam = "DC=Mydomain,DC=COM", $sAD_HostServerParam = "NSDC01")

So what is the $sAD_ConfigurationParam anyways? I don't have that as an OU, even in advanced view


C0d3 is P0etry( ͡° ͜ʖ ͡°)

Share this post


Link to post
Share on other sites

Your _AD_Open command is written wrong.

Global $sAD_UserIdParam = "ServiceProfile", $sAD_PasswordParam = "MyPassword", $sAD_DNSDomainParam = "DC=MyDomain,DC=COM", $sAD_HostServerParam = "MyDomainController"
_AD_Open($sAD_UserIdParam, $sAD_PasswordParam, $sAD_DNSDomainParam, $sAD_HostServerParam)

You have to pass just the CONTENTS of the variables to the function, you can't assign the values to the variables and pass them at the same time.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Your _AD_Open command is written wrong.

Global $sAD_UserIdParam = "ServiceProfile", $sAD_PasswordParam = "MyPassword", $sAD_DNSDomainParam = "DC=MyDomain,DC=COM", $sAD_HostServerParam = "MyDomainController"
_AD_Open($sAD_UserIdParam, $sAD_PasswordParam, $sAD_DNSDomainParam, $sAD_HostServerParam)

You have to pass just the CONTENTS of the variables to the function, you can't assign the values to the variables and pass them at the same time.

when I tried it that way, I got Error 6 (Parameter $sAD_HostServerParam and $sAD_ConfigurationParam are required when $sAD_DNSDomainParam is specified)

When I strip out the $sAD_HostServerParam and $sAD_ConfigurationParam, I get an error 4 again... Current code looks like this now:

#include <ad.au3>


Global $sAD_UserIdParam = "ServiceProfile", $sAD_PasswordParam = "MyPassword"

_AD_Open($sAD_UserIdParam, $sAD_PasswordParam)
If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended)

$fullou = (_AD_SamAccountNameToFQDN("mkovacic"))
Msgbox(0, "Message", "This is Mikes OU:" & @CRLF & $fullou)
   _AD_Close()

C0d3 is P0etry( ͡° ͜ʖ ͡°)

Share this post


Link to post
Share on other sites

$sAD_ConfigurationParam has to be specified. If not you get an error message.

If the user is currrently connected to a domain: _AD_Open() is enough because all parameters are being taken from the current connection.

If the user isn't connected to a domain (local user) you have to specify all parameters for _AD_Open. As described in the wiki.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-02-09 - Version 1.4.1.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

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  

  • Similar Content

    • By BetaLeaf
      What is Rollbar?
      Rollbar provides real-time error alerting & debugging tools for developers. Learn more about it at https://rollbar.com/product/
      Demo: https://rollbar.com/demo/demo/
      Screenshot:
      Instructions: (RollbarTest.au3)
      ; Include RollbarSDK #include "RollbarSDK.au3" ;Turns on ConsoleWrite debugging override. ;Global $Rollbar_Debug=False ; Initialize RollbarSDK with the project's API key. ; Parameters ....: $__Rollbar_sToken - [Required] Go to https://rollbar.com/<User>/<ProjectName>/settings/access_tokens/ for your project. Use the token for post_server_item. _Rollbar_Init("eaa8464a4082eeabd9454465b8f0c0af") ; Write code that causes an error you want to catch, then call ; _Rollbar_Send ; Parameters ....: $__Rollbar_sErrorLevel - [Required] Must be one of the following values: Debug, Info, Warning, Error, Critical. ; $__Rollbar_sMessage - [Required] The message to be sent. This should contain any useful debugging info that will help you debug. ; $__Rollbar_sMessageSummary - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend. _Rollbar_Send("Debug", "This is an debug message. If you received this, you were successful!", "Debug Message") _Rollbar_Send("Info", "This is a test message. If you received this, you were successful!", "Info Message") _Rollbar_Send("Warning", "This is an warning message. If you received this, you were successful!", "Warning Message") _Rollbar_Send("Error", "This is an error message. If you received this, you were successful!", "Error Message") _Rollbar_Send("Critical", "This is an critical message. If you received this, you were successful!", "Critical Message") _Rollbar_Send("Info", "This is a test message. If you received this, you were successful!") ;No Message ; Rollbar_Send's helper functions ; Parameters ....: $__Rollbar_sMessage - [Required] The message to be sent. This should contain any useful debugging info that will help you debug. ; $__Rollbar_sMessageSummary - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend. _Rollbar_SendDebug("This is an debug message. If you received this, you were successful!", "Debug Message") _Rollbar_SendInfo("This is a test message. If you received this, you were successful!", "Info Message") _Rollbar_SendWarning("This is an warning message. If you received this, you were successful!", "Warning Message") _Rollbar_SendError("This is an error message. If you received this, you were successful!", "Error Message") _Rollbar_SendCritical("This is an critical message. If you received this, you were successful!", "Critical Message") ; Usable Example Local $sImportantFile = "C:\NOTAREALFILE_1234554321.txt" Switch FileExists($sImportantFile) Case True MsgBox(0, "Example Script", "An important file was found. Continuing...") Case Else _Rollbar_SendCritical('An important file was missing. Halting... File: "' & $sImportantFile & '"', 'Important file "' & $sImportantFile & '" is missing.') EndSwitch Notes: Please comment your feedback, advice, & suggestions below. While this is only a proof of concept, I will expand its feature set for everyone to use. 
      Right now, it is fully functional but not tested in production.
       
       
      Changelog:
      RollbarSDK.au3
      RollbarTest.au3
      v0.2
       
      v0.1.1
       
    • By Dwalfware
      Hi Folks
      Can not get my head around this one.
      This function gets the DNS object s
      If you have two DNS entries fine. but if you have only one! Trouble
      $objItem.DNSServerSearchOrder[0] = Primary DNS
      $objItem.DNSServerSearchOrder[1] = Secondry DNS not always there. I need a way to return 0 if not there or the IP if its there.
      Or is there a way to tell how many objects there are in the "[?]"
      I'm terrible at WMI errors, thanks for help in advance.
      Func _GETcurrentNICinfo2() $oErrors = ObjEvent("AutoIt.Error", "Error_Handle") Local $DnsSecondry Local $objWMIService = ObjGet( "winmgmts:\\" & @ComputerName & "\root\CIMV2" ) Local $query = $objWMIService.ExecQuery("SELECT DNSServerSearchOrder FROM Win32_NetworkAdapterConfiguration WHERE Index = " & _GetSelectedNIC(), "WQL", 0x30 ) If @error Then Return 0 If NOT IsObj($query) Then Return 0 Else For $objItem In $query Return $objItem.DNSServerSearchOrder[1] next Endif EndFunc  
    • By rudi
      Hello,
       
      <edit>
      In this posting below you will find a script to get an Active Directory User's Group Memberships including nested Group Memberships:
       
      </edit>
      quite a while ago I started this thread: https://www.autoitscript.com/forum/topic/193984-ad-member-of-group-in-group/
       
      #include <AD.au3> _AD_Open() $user=_AD_SamAccountNameToFQDN("ASP") $group=_AD_SamAccountNameToFQDN("daten-Bestellung-QS_lesen") $result=_AD_IsMemberOf($group,$user,false,True) ; $Group is the 1st, $User the 2nd param ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $result = ' & $result & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console _AD_Close() this works fine, thanks for the help in the other thread.
      Howto to get the "chain" of groups for nested group memberships?

      In AD.AU3 I found the function _AD_RecursiveGetMemberOf(), which might be an approach, (get all the group content then sort out what's needed), just wondering if there is another function that I've overlooked, that directly would give me the "nested membership chain" *ONLY*?
       
      Regards, Rudi.
    • By vati1011
      Hey, guys.
      Currently, I'm using Opencv UDF and i'm  encountering issues with DLLOPEN(). it is failing and returning -1
      But, I cannot figure out why it is failing.
      I need help from people.
      I'm running windows 10 32bit.
      This's my code.
      #RequireAdmin $fileopen = DllOpen("opencv_core2413.dll") MsgBox(0,"Result",$fileopen) Example.au3opencv_core2413.dll
    • By tweakster2010
      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.
×
×
  • Create New...