Jump to content

Active Directory UDF (II)


Recommended Posts

BTW: Does this work for you (replace <Domain> and <User> with real data)?

$oObjectUser = ObjGet("WinNT://<Domain>/<User>")
ConsoleWrite("Locked: " & $oUser.IsAccountLocked & @CRLF)

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites
  • Replies 298
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Thanks for this function I'm thinking about to extend the UDF with a function to delete objects plus leaf nodes and OUs including all contained objects/leafs/subOUs. This function will be based

As the Active Directory UDF thread has grown too big, I start a new one. The original thread can be found here.

$Users = _AD_GetObjectsInOU("OU=Department,OU=Users,OU=topOU,DC=company,DC=local", "(&(objectcategory=person)(objectclass=user)(!userAccountControl:1.2.840.113556.1.4.803:=" & $ADS_UF_AC

Posted Images

43 minutes ago, water said:

_AD_IsObjectLocked retrieves the LockoutTime from AD. Then it uses function _AD_GetPasswordInfo to retrieve the Lockout Duration to calculate the time when the object gets unlocked again.
The AD UDF does not support fine grained password policy - which means that this causes the current problem.

Will there be added support for that in the future? :) 

Link to post
Share on other sites

No plans so far. I will start a survey and see how many people would like so see such a feature.

But as I have no access to our AD (I'm an ordinary user, no admin), I would need someone to test this new feature ;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

Survey added:

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

legend,

to get a better understanding of how FGPPs work, could you please use the "Copy Data Only" function for the displayed array of example 1 of _AD_GetObjectProperties.au3 run on a user with FGPPs activated?
Please remove all sensitive/company related information and send the data via PM.

This way I hope  to determine the effort it takes to add FGPP support to the AD UDF.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

According to this website ...

Quote

The settings on the PSO may be considered confidential; therefore, by default Authenticated Users do not have Read Property permissions for a PSO. By default, only members of the Domain Admins group have Read Property permissions on default security descriptor of the PSO object in the schema.

That's why I do not see any information about PSOs (Password Settings objects) in your user account.
This means some modifications need to be done by the AD admin before an ordinary AutoIt script can read the properties :(

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

Yes, based on your data plus info from the website I came to the conclusion I posted in #26.

16 hours ago, water said:

That's why I do not see any information about PSOs (Password Settings objects) in your user account.
This means some modifications need to be done by the AD admin before an ordinary AutoIt script can read the properties :(

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites
On 1/5/2017 at 7:10 AM, water said:

No plans so far. I will start a survey and see how many people would like so see such a feature.

But as I have no access to our AD (I'm an ordinary user, no admin), I would need someone to test this new feature ;)

Your a regular user?!  No way..  I'm on to your shenanigans, water.:P

Link to post
Share on other sites

No joke. I already posted that in 2009

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites
  • 5 weeks later...

UPDATE: SOLVED

I recently purchased a new laptop which is setup on my domain and is plugged in through ethernet. I have no issues with any domain related tasks but for some reason my AD scripts no longer work. I used to be able to use _AD_Open() and all worked fine, but now I have to fill in all the parameters in order for it to connect. Now I am receiving an error when working with the function _AD_SamAccountNameToFQDN. I am trying the _AD_SamAccountNameToFQDN.au3 example file and this is what I am receiving

==> The requested action with this object has failed.:
Local $oRecordSet = $__oAD_Command.Execute
Local $oRecordSet = $__oAD_Command^ ERROR

When I implement _AD_ErrorNotify(1) this is what I am receiving:

COM Error Encountered in _AD_SamAccountNameToFQDN.au3
AD UDF version = 1.4.1.1
@AutoItVersion = 3.3.14.2
@AutoItX64 = 0
@Compiled = 0
@OSArch = X64
@OSVersion = WIN_10
Scriptline = 465
NumberHex = 80020009
Number = -2147352567
WinDescription = Exception occurred.
Description = An invalid dn syntax has been specified.
Source = Active Directory
HelpFile = 
HelpContext = 0
LastDllError = 0
========================================================
COM Error Encountered in _AD_SamAccountNameToFQDN.au3
AD UDF version = 1.4.1.1
@AutoItVersion = 3.3.14.2
@AutoItX64 = 0
@Compiled = 0
@OSArch = X64
@OSVersion = WIN_10
Scriptline = 465
NumberHex = 80020009
Number = -2147352567
WinDescription = Exception occurred.
Description = An invalid dn syntax has been specified.
Source = Active Directory
HelpFile = 
HelpContext = 0
LastDllError = 0

Any advice on how to troubleshoot this?

Edited by crashnburn
Link to post
Share on other sites

Could you please download the latest version (1.4.7.0) of the AD UDF?
IIRC the COM error handling was enhanced for AutoIt 3.4.12.x

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites
  • 2 weeks later...

Where do I download the new version of this UDF? 1.4.7.0

 

How do retrieve only content and not the number of how many itemts by using _AD_GetObjectsInOU. It tried this:

_AD_GetObjectsInOU($sOU,Default,Default,Default,Default,True,Default)

I tried to look at the WiKi, but it seems that there is less paramters.

https://www.autoitscript.com/wiki/Active_Directory_UDF_-_GetObjectsInOU

My version is 1.4.6.0

 

If I look in your hidden contents I see there is a "download" for 1.4.7.0, but that just point me to this page.

Yours sincerely

Kenneth.

Link to post
Share on other sites

Good finding! The download link is fixed now.

The UDF does not support the Default keyword. Please check the wiki (section Tips & Tricks) for this.
Hence

_AD_GetObjectsInOU($sOU)

should do what you want.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

Tried to download it, but it seems it is the same as 1.4.6.0.

The header in AD.au3 says it's 1.4.6.0 and the _AD_getObjectsInOU still have the same parameters.

When I do this.

$aComputers = _AD_GetObjectsInOU("OU=Desktops,OU=bla bla bla")
    _ArrayDisplay($aComputers, "Computers")
    
    $aComputersSource = _AD_GetObjectsInOU("OU=Laptops,OU=bla bla bla")
    _ArrayDisplay($aComputersSource, "ComputersSource")
    
    _ArrayConcatenate($aComputers, $aComputersSource)

My first _ArrayDisplay is like this:

Row Col0
[0] 114
[1] Desktop1
[2] Desktop2
[3] Desktop3
[4] Desktop4
ect..
[112]   Desktop112
[113]   Desktop113
[114]

My 2nd _ArrayDisplay i like this:

Row Col0
[0] 628
[1] Laptop1
[2] Laptop2
[3] Laptop3
[4] Laptop4
ect..
[626]   Laptop112
[627]   Laptop113
[628]

My _ArrayConcatenate is like this:

Row Col0
[0] 114
[1] Desktop1
[2] Desktop2
[3] Desktop3
[4] Desktop4
ect..
[112]   Desktop112
[113]   Desktop113
[114]
[115]   628
[116]   Laptop1
[117]   Laptop2
[118]   Laptop3
[119]   Laptop4
ect..
[741]   Laptop112
[742]   Laptop113
[743]

How can I avoid row [0] + [114] +[115] + [743]?

I just want all our computers in the array.

Yours sincerely

Kenneth.

Link to post
Share on other sites

On the download page you will see that version 1.4.7.0 only added a html file containing all the help for the AD UDF.

The AD UDF always returns a 1 based array (means: row 0 contains the row (and column) count),
But _ArrayConcatenate allows to specify on which row to start concatenation (parameter $iStart). Set this value to 1 and the problem is solved ;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

You need to process $aComputers as well:

Global $aResult[]
_ArrayConcatenate($aResult, $aComputers, 1)
_ArrayConcatenate($aResult, $aComputersSource, 1)
_ArrayDisplay($aResult)

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

Example:

#include <Array.au3>
Global $aResult[0]
Global $aComputers[] = [3, "C1", "C2", "C3"]
Global $aComputersSource[] = [2, "C4", "C5"]
_ArrayConcatenate($aResult, $aComputers, 1)
_ArrayConcatenate($aResult, $aComputersSource, 1)
_ArrayDisplay($aResult)

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...