Jump to content

Active Directory UDF


water
 Share

Recommended Posts

Glad you could solve your problem :)
_AD_FQDNToSamAccountName is no longer needed because all functions now accept SamAccountName or FQDN as a parameter.

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 comment
Share on other sites

What's the value of @error and @extended after calling the function?

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 comment
Share on other sites

This is the general exception error :x

Are you sure you have the permission to modify the user account?

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 comment
Share on other sites

Yes I used my Domain admin account and it worked with all other fields.

By the way I managed to change the "thumbnailPhoto" field but:

1.How can I retrieve what is in the field to verify if it is OK?

2.Do you know maximun picture filesize, cuz if it is higher than 8k you can't see hexa content in AD 

 

Link to comment
Share on other sites

"thumbnailPhoto".

  • Seems to be limited to 10K by default. But you can set the RangeUpper value in the Schema for this attribute. Performance might be a issue with larger pictures.
  • Only accepts JPG
  • MS recommends pictures with 96*96 pixels and a max size of 10KB
  • A good reading

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 comment
Share on other sites

Yes I used my Domain admin account and it worked with all other fields.

Can you please insert

_AD_ErrorNotify(2)

before calling _AD_ModifyAttribute?

This will return more detailed error information.

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 comment
Share on other sites

Description: Access is denied.  Which is strange cuz I'm the Domain admin and in fact I changed all other fields.

I tested with other pass and didn't get any error althougt didn't change the value but as in the case of the thumbnail picture it took 24hs to perform the change.

Thanks a lot for the Thumbnail picture and for your help.

Regards.

Edited by jcpetu
Link to comment
Share on other sites

24hs to perform a change. Then there might something be wrong with replication.

If you specify the DC when calling _AD_Open you can immediately check for correct completion of the update.

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 comment
Share on other sites

Hi Water, I did this piece of code to getsave the Thumnail photo to file. The file is created but not as a jpg picture. Would you please help me.

thanks in advance and regards.

#include <AD.au3>
#include <File.au3>

_AD_Open()
If @error Then Exit
$ThumbNailPhoto = _AD_GetObjectAttribute(@UserName, "thumbnailPhoto")
If @error Then $ThumbNailPhoto = ""
_AD_Close()

$File = FileOpen(@ScriptDir & "\UserPic.jpg", 18)
FileWrite($File, $ThumbNailPhoto)
FileClose($File)
Link to comment
Share on other sites

To check the photo I would use the tool mentioned in the article I referred to in post #1127

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 comment
Share on other sites

Hi Water, I'm trying to retrieve the following fields that are visible from the Attribute Editor, but I got an empty array. Should I retrieve them by another command?

Thanks in advance and regards.

$aObjects = _AD_GetObjectsInOU($sOU, "(objectclass=computer)", 2, "name,lastLogonTimestamp,lastLogon,pwdLastSet")
 

Link to comment
Share on other sites

  • Moderators

Something like this?

#include <AD.au3>
_AD_Open()
 
$aProperties = _AD_GetObjectProperties(@UserName, "displayname,accountExpires")
 _ArrayDisplay($aProperties)
Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

 

Something like this?

#include <AD.au3>
_AD_Open()
 
$aProperties = _AD_GetObjectProperties(@UserName, "displayname,accountExpires")
 _ArrayDisplay($aProperties)

 

No the accountExpires doesn't give me the date and time when it expires. I created a new function with the _AD_IsAccountExpired (@username) and changed the line 3958 from the AD.au3 to 

If $sAccountExpires <> "19700101000000" And StringLeft ($sAccountExpires, 8) <> "16010101" Then Return $sAccountExpires

Then I only had to format the string that it returned

Link to comment
Share on other sites

Hi Water, I'm trying to retrieve the following fields that are visible from the Attribute Editor, but I got an empty array. Should I retrieve them by another command?

Thanks in advance and regards.

$aObjects = _AD_GetObjectsInOU($sOU, "(objectclass=computer)", 2, "name,lastLogonTimestamp,lastLogon,pwdLastSet")

_AD_GetObjectsInOU doesn't translate the properties into a readable format. That's what _AD_GetObjectProperties is for. Unfortunately you need to retrieve the properties for every object.

A combined function can be found >here.

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 comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...