Jump to content
Sign in to follow this  
Nogo

_AD_GetObjectAttribute gives unexpected result

Recommended Posts

Nogo

Hello

I'm trying to get email from AD with _AD_GetObjectAttribute.

the following script gives back email adress for given sAMAccountName:

#include <AD.au3>
Global $aProperties
_AD_Open()
If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended)
$aProperties = _AD_GetObjectAttribute("anysAMAccountName", "mail")
ClipPut($aProperties)
MsgBox(0,"",$aProperties)
_AD_Close()

Tried many sAMAccountName's it works good, but on one Name 'XiaopenL' result is:

'$FUNCTION.CONET_JS_toLowerCase($FUNCTION.CONET_JS_CheckEMail($FUNCTION.CONET_JS_changeUmlaut($FUNCTION.CONET_JS_getFirstPart(Lu)$$)$$.$FUNCTION.CONET_JS_changeUmlaut($FUNCTION.CONET_JS_getFirstPart(Xiaopeng)$$)$$@xxx.xx!!99999999)$$)$$'

This is not the mail adress. Is it a failure of the AD-server?

Edited by Nogo

Share this post


Link to post
Share on other sites
water

Please a look at this site. It describes attributee mail and proxyAddresses.

Could you get the values of attribute "proxyAddresses"? Be aware that it is a multivalue attribute and hence _AD_GetObjectAttribute returns an array.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - 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
Nogo

Could you get the values of attribute "proxyAddresses"?

No it is not set.

But I've downloaded 'Active Directory Explorer'. -> The mail adress of sAMAccountName "XiaopenL" is set to

$FUNCTION.CONET_JS_toLowerCase($FUNCTION.CONET_JS_CheckEMail($FUNCTION.CONET_JS_changeUmlaut($FUNCTION.CONET_JS_getFirstPart(Lu)$$)$$.$FUNCTION.CONET_JS_changeUmlaut($FUNCTION.CONET_JS_getFirstPart(Xiaopeng)$$)$$@xxx.xx!!99999999)$$)$$

So everything is working ok. The Database is not tended right.

I didn't expected that this is the failure.

Many thanks for your help and for the link.

Edited by Nogo

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

    • Trinnon
      By Trinnon
      I have a question about the @error logging features in _AD_CreateUser.  Hopefully I am just missing something obvious.
      In my app I am creating a user if it does not exist then manipulating some attributes. 
      If the user does exist I would then call another function to remove groups from the user and modify some attributes.
      My question is...
      If the user already Exists, the _AD_CreateUser option gives $iValue = 0 and @error = 0.
      How can @error = 1 for the condition that the user already exists?
       
      I copied a small ship of the code in question along with my full .au3. 
      I am using AD UDF 1.4.9.0 (Water, thanks for the awesome work on this!!!).
      $iValue = _AD_CreateUser ($sOU, $sUser, $sCN)
      If $iValue = 1 Then
            _FileWriteLog ($Log, "Func UserCheck() - User '" & $sUser & "' successfully created ==> Calling UserAttribsNewUser Function.")
            Call ("NewUser")
      ElseIf @error = 1 Then
            _FileWriteLog ($Log, $sUser & " already exists ==> Calling UserAttribsExistingUser Function.")
            Call ("ExistingUser")
       
      AccountSettingConfigurations-Test1.au3
       
    • water
      By water
      Extensive library to control and manipulate Microsoft Active Directory.

      Threads: Development - General Help & Support - Example Scripts - Wiki
      Previous downloads: 30467
       
      Known Bugs: (last changed: 2018-06-01)
      None  
      Things to come: (last changed: 2018-06-01)
      None
      BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort
    • rudi
      By rudi
      Hello,
       
      from this posting of @Jos https://www.autoitscript.com/forum/topic/162005-getting-windows-users-account-type/?do=findComment&comment=1176831
      I can smoothly check, if a user is a *DIRECT* group member. Has anybody some code to check also, if a user is a *INDIRECT* member of a cascaded group construct?  Maybe with @Melba23 's AD UDF?
       
      The required rights are granted to group "Dept_B" User John is member of group "Dept_A" Group "Dept_A" is member of the group "Dept_B" So in the AD / NTFS FS environment John finally has the rights of both groups But when checking his "membership to group Dept_B" the result is "no member". The approach I can think of would be, to check all Group Members of group "Dept_B" whether they are of type group, then check again if "John" is member of than " 2nd level group"
      Func UserInGroup($InGroup,$ThisUser=@LogonDomain & "/" & @UserName) Local $objUser = ObjGet("WinNT://" & $ThisUser ) For $oGroup in $objUser.Groups If $oGroup.Name = $InGroup Then Return 1 EndIf Next Return 0 EndFunc Any suggestions appreciated, regards, Rudi.
    • water
      By water
      ADAT is a tool to simplify common AD administration tasks. Every administration task has its own tab. It is easy to add new functions (tabs) to the tool. Some often used functions are already available: list users, computers, OUs. File ADAT.ini can be customized to hold the AD logon information if necessary.
      Known Bugs:
      2018-03-07: If the Script started from SciTE works but the "Process" button in the compiled exe does not do anything then please add the following line at the top of your script:
      #Au3Stripper_Ignore_Funcs=Process_Tab*
        BTW: If you like this tool please click the "I like this" button. This tells me where to next put my development effort
    • bouzzi
      By bouzzi
      Hi guys,
      I'm trying to make a script that could tell me, from a username list file,  if the username is active, inactive or not existant  in a multi-domain Active Directory....
      I found a few scripts giving me hints but I found nothing to help me to accomplish this task...
      Do you have any ideas !
      Thanks
      Bouzzi!
       
×