Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Active Directory UDF


  • Please log in to reply
1205 replies to this topic

#41 supersonic

supersonic

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 470 posts

Posted 29 January 2010 - 06:52 PM

Thank you for this helpful link... :D
That's the way it seems to be... :huggles:







#42 water

water

    ?

  • MVPs
  • 15,526 posts

Posted 29 January 2010 - 06:56 PM

Why do you query this group? What information do you want to get?
UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

#43 supersonic

supersonic

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 470 posts

Posted 29 January 2010 - 08:15 PM

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

#44 supersonic

supersonic

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 470 posts

Posted 01 February 2010 - 08:03 AM

Hi Water,

can you provide me the modified _AD_GetObjectProperties()-function
which returns readable GUIDs and SIDs?

Greets,
-supersonic.

#45 JonnyThunder

JonnyThunder

    Adventurer

  • Active Members
  • PipPip
  • 107 posts

Posted 01 February 2010 - 03:24 PM

You've done a brilliant job on this sir, thanks for the effort!

#46 water

water

    ?

  • MVPs
  • 15,526 posts

Posted 01 February 2010 - 03:26 PM

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, 01 February 2010 - 03:27 PM.

UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

#47 JonnyThunder

JonnyThunder

    Adventurer

  • Active Members
  • PipPip
  • 107 posts

Posted 01 February 2010 - 03:43 PM

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

#48 water

water

    ?

  • MVPs
  • 15,526 posts

Posted 01 February 2010 - 03:57 PM

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.
UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

#49 supersonic

supersonic

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 470 posts

Posted 01 February 2010 - 04:22 PM

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.

#50 JonnyThunder

JonnyThunder

    Adventurer

  • Active Members
  • PipPip
  • 107 posts

Posted 01 February 2010 - 04:56 PM

That's quite odd - we have 6000 or so users and it works fine for me.

Water : nice one, I'll keep an eye on this page for updates!

#51 supersonic

supersonic

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 470 posts

Posted 02 February 2010 - 05:28 AM

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, 02 February 2010 - 05:33 AM.


#52 water

water

    ?

  • MVPs
  • 15,526 posts

Posted 02 February 2010 - 08:46 AM

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.
Spoiler

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, 02 February 2010 - 11:50 AM.

UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

#53 supersonic

supersonic

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 470 posts

Posted 02 February 2010 - 12:37 PM

Hi Water,

I've switched over to the "General Help and Support" thread... :D

Greets,
-supersonic.

#54 supersonic

supersonic

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 470 posts

Posted 02 February 2010 - 02:34 PM

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.

#55 water

water

    ?

  • MVPs
  • 15,526 posts

Posted 02 February 2010 - 02:40 PM

Hi supersonic,

this is already included via date.au3.
I was wondering how the example scripts would have been working otherwise.

water
UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

#56 TomV

TomV

    Seeker

  • Active Members
  • 20 posts

Posted 03 February 2010 - 03:10 PM

I Can say one thing:
THANKS for this great UDF!


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

Tom
My UDF's:1. _ChooseIconAnd this is just the beginning

#57 water

water

    ?

  • MVPs
  • 15,526 posts

Posted 03 February 2010 - 03:16 PM

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.
UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

#58 TomV

TomV

    Seeker

  • Active Members
  • 20 posts

Posted 03 February 2010 - 04:27 PM

Ok, what do you need to have for that, i'll test it.
Any screenshots? Vids?

Tom
My UDF's:1. _ChooseIconAnd this is just the beginning

#59 water

water

    ?

  • MVPs
  • 15,526 posts

Posted 03 February 2010 - 05:34 PM

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
UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

#60 water

water

    ?

  • MVPs
  • 15,526 posts

Posted 09 February 2010 - 04:33 PM

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.
UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users