Jump to content

Recommended Posts

Posted

Why do you query this group? What information do you want to get?

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Nothing very special...

First, it was a bit strange and confusing to me:

Querying group members for "Domain Users" = empty,

querying member's groups = "Domain Users" present.

Second, the function I used before lists all group members for "Domain Users".

But as the linked forum post explained: This is normal... :D

Posted (edited)

I'm glad you like it!

But it mainly the effort of Jonathan Clelland. I just brushed it up and extended it a bit.

Edited by water

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

It's still hugely impressive - many thanks to you and Jonathan Clelland for all the work.

I've just been raking through the list of examples and they all work beautifully. I've got a big project away to start which will require a lot of AD integration and querying so this just saved me a huge chunk of time.

Nice one fella. :D

Posted

Hi JonnyThunder,

please wait a few minutes before you start with your project.

There might be some script breaking changes in the next version. Some functions use "ByRef" to return data but most of the functions don't.

I think about removing the "ByRef" so the calls to the functions might change.

I'm going to do some performance checks and if there is little difference then I'm going to change it.

I'll keep you informed.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Hi Water,

thank you for V0.34. Good job! :D

When I query 300+ users by _AD_GetObjectProperties() the script stops with an:

!>17:17:07 AutoIT3.exe ended.rc:-1073741819

... error. Without _AD_GetObjectProperties() the scripts runs fine.

Maybe it is the user count; querying 10-20 works without errors...

Putting Sleep(0100) somewhere between doesn't help...

Any ideas about this?

Greets,

-supersonic.

Posted (edited)

JonnyThunder,

if it works fine for you... Maybe you - or somebody else - can help me or give me a clue:

At first I run a query like this to get all users (and some of their attributes):

_AD_GetObjectsInOU($aTmp1, $GUICtrlRead, "(&(objectCategory=user))", 2, _ArrayToString($aADQAttributes, ",", 1, 0), "")

After that I would like to get some "encoded" attributes of each user:

Local aADQAttributes ; An one-based array of attributes. If there is a match, the value will be returned to $aTmp2.
Local $aTmp2
_AD_InjectObjectProperties($aTmp2, $aADQAttributes, _AD_FQDNToSamAccountName($aTmp1[$i][1]))
.
.
.
Func _AD_InjectObjectProperties(ByRef $iArr1, ByRef Const $iArr2, $iStr = "")
    Local $aAttr[7] = ["accountExpires", "badPasswordTime", "lastLogon", "lastLogonTimestamp", "objectGUID", "objectSID", "pwdLastSet"]
    Local $aProp    = _AD_GetObjectProperties($iStr)
    If @error <> 1 Then
        For $i = 0 To UBound($aAttr) - 1 Step 1
            Local $vTmp1 = _ArraySearch($iArr2, $aAttr[$i], 1, 0, 0, 0, 1, 0)
            If $vTmp1 > 0 Then
                Local $vTmp2 = _ArraySearch($aProp, $aAttr[$i], 1, 0, 0, 0, 1, 0)
                If $vTmp2 > 0 Then
                    $iArr1[$vTmp1 - 2] = $aProp[$vTmp2][1] ; Less array index and hidden/invisible attribute. "Something" special; please ignore...
                EndIf
            EndIf
        Next
    EndIf
EndFunc

Maybe the code isn't very good!? Could someone provide a better example?

Greets,

-supersonic.

Edited by supersonic
Posted (edited)

Sounds strange: If I convert your returncode to hex I get 0xC0000005. Google returns some very strange results on that.

Where (is the line number in your script or somewhere in the AD UDF) do you get this error?

I've modified _AD_GetObjectProperties so you can specify which attributes to return in a comma seprated list.

So

$aProperties = _AD_GetObjectProperties(@UserName,"accountExpires, badPasswordTime, lastLogon, lastLogonTimestamp, objectGUID, objectSID, pwdLastSet")
should do the trick.

  Reveal hidden contents

BTW: Could we move discussions of errors in user scripts to the "General help and Support" forum? I've opened a thread there.

This thread I would like to reserve for announcements and discussions of new functions.

Edited by water

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Hi Water,

AD.au3 uses the functions _Security__IsValidSid(), _Security__SidToStringSid() and _WinAPI_StringFromGUID().

They are part of Security.au3 and WinAPI.au3. Make it sense to you to #include them in AD.au3?

Greets,

-supersonic.

Posted

Hi supersonic,

this is already included via date.au3.

I was wondering how the example scripts would have been working otherwise.

water

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

I Can say one thing:

THANKS for this great UDF!

PS: I recommend this to add to the "included with installation" UDF

Tom

[font="Comic Sans MS"][size="4"]My UDF's:[/size]1. _ChooseIconAnd this is just the beginning[/font]

Posted

Hi TomV,

glad you like the UDF.

I try to get it included with the standard AutoIt installation as soon as we've reached version 1.0.

That means function freeze and some successful tests of people who have write access to their AD. Some Exchange related functions will come in the next few weeks.

I've already tried to contact the maintainer of the UDFs but didn't get any response 'til now.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Hi TomV,

just a bit of testing. I can't test the functions that modify the AD (I onyl have read access). If you like you could run the example scripts that alter the AD and report any problems you see.

Please be careful and use a test environment!

Thanks!

water

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Hi Jaymac,

thanks for your reply!

You don't have to run the AD.au3 :D That's the UDF itself which is called by all the other example scripts.

But I think it's a good idea to add a readme.txt file that explains how to install the UDF and the associated files.

My UDFs and Tutorials:

  Reveal hidden contents

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...