Jump to content

Active Directory UDF - Help & Support


water
 Share

Recommended Posts

I'm no AD guru so I don't know if all user properties can be be queried.

But a modified _AD_ObjectExists function could check if the property is defined in the AD Schema. So you can make sure the property exists before doing a query.

How does this sound?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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 supersonic,

here is a quick and dirty testversion:

Func _AD_ObjectExistsInSchema($sAD_Object)

    $sAD_SchemaNamingContext = $oAD_RootDSE.Get("SchemaNamingContext")
    Local $sAD_Query = "<LDAP://" & $sAD_HostServer & "/" & $sAD_SchemaNamingContext & ">;(LDAPDisplayName=" & $sAD_Object & ");ADsPath;subtree"
    Local $oAD_RecordSet = $oAD_Connection.Execute($sAD_Query) ; Retrieve the FQDN for the object
    If Not IsObj($oAD_RecordSet) Or $oAD_RecordSet.RecordCount = 0 Then Return 0
    Return 1

EndFunc ;==>_AD_ObjectExistsInSchema

So to check for "extensionAttribute1" you would call:

_AD_ObjectExistsInSchema("extensionAttribute1")

The function returns 1 if the object exists in the Schema otherwise 0.

Could you please test this function in your environment and post the results?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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 supersonic,

it's already in the pipeline for the next version!

Have a nice weekend,

Water

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

Having an issue with _AD_CreateMailbox

Sorry to threadjack, but I though this might be an appropriate place. I'm trying to use the above function but keep winding up with the errors in the attached images no matter if I use the sample code or my own. I'm attempting to create a mailbox for a user made with _AD_CreateUser (which doesn't automatically create the mailbox on my system).

post-55677-12762865764161_thumb.png

post-55677-1276286681687_thumb.png

Any help would be GREATLY appreciated, as I'm a good portion through an automated user-provisioning script.

Regards,

Larry

Hi Larry,

could you please provide either a screenshot of the example script for _AD_CreateMailbox (the example script takes your mailbox settings, splits it and displays it) or the parameters you pass to _AD_CreateMailBox in your own script?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

Thank you! :mellow: ..

Love to see that happen..

The now available version 0.39 should already incorporate all changes.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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 Larry,

could you please provide either a screenshot of the example script for _AD_CreateMailbox (the example script takes your mailbox settings, splits it and displays it) or the parameters you pass to _AD_CreateMailBox in your own script?

Sure. Here's my function:

Func CreateUser()
    $newUser = _AD_CreateUser($newUserOU, $sAMAccountName, $cn)

    if $newUser = 1 then 
        _AD_ModifyAttribute($sAMAccountName, "name", $cn)
        _AD_ModifyAttribute($sAMAccountName, "displayName", $cn)
        _AD_ModifyAttribute($sAMAccountName, "givenName", $givenName)
        _AD_ModifyAttribute($sAMAccountName, "initials", $initials)
        _AD_ModifyAttribute($sAMAccountName, "sn", $sn)
        _AD_ModifyAttribute($sAMAccountName, "description", $description)
        _AD_ModifyAttribute($sAMAccountName, "physicalDeliveryOfficeName", $physicalDeliveryOfficeName)
        _AD_ModifyAttribute($sAMAccountName, "postalCode", $postalCode)
        _AD_ModifyAttribute($sAMAccountName, "st", $st)
        _AD_ModifyAttribute($sAMAccountName, "streetAddress", $streetAddress)
        _AD_ModifyAttribute($sAMAccountName, "title", $title)
        _AD_ModifyAttribute($sAMAccountName, "telephoneNumber", $telephoneNumber)
        _AD_ModifyAttribute($sAMAccountName, "facsimilieTelephoneNumber", $facsimilieTelephoneNumber)
        
        _AD_CreateMailbox($sAMAccountName, "Mailbox Store (" & $mailServer & ")")
    endif
EndFunc

I've named my attribute variables so that they match up with the information being passed. $NewUserOU is similar to OU=PH,DC=companyname,DC=com

Link to comment
Share on other sites

You omit a lot of parameters of the _AD_CreateMailbox call. According to the help file:

;   $sAD_Store - Optional: Information store (Default = "First Storage Group")
;   $sAD_EmailServer - Optional: Email server (Default = First server returned by _AD_ListExchangeServers())
;   $sAD_AdminGroup - Optional: Administrative group in Exchange (Default= "First Administrative Group")
;   $sAD_EmailDomain - Optional: Exchange Server Group name e.g. "My Company" (Default = Text after first DC= in $sAD_DNSDomain)

Do the default values fit your environment?

What does _AD_CreateMailbox return (@error, @extended)?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

You omit a lot of parameters of the _AD_CreateMailbox call. According to the help file:

;   $sAD_Store - Optional: Information store (Default = "First Storage Group")
;   $sAD_EmailServer - Optional: Email server (Default = First server returned by _AD_ListExchangeServers())
;   $sAD_AdminGroup - Optional: Administrative group in Exchange (Default= "First Administrative Group")
;   $sAD_EmailDomain - Optional: Exchange Server Group name e.g. "My Company" (Default = Text after first DC= in $sAD_DNSDomain)

Do the default values fit your environment?

What does _AD_CreateMailbox return (@error, @extended)?

I see that, but all of those are optional. I shouldn't necessarily need them, especially when the information matches the defaults. That's what optional means, right?

@error: -2147352570
@extended: 0
Link to comment
Share on other sites

I see that, but all of those are optional. I shouldn't necessarily need them, especially when the information matches the defaults. That's what optional means, right?

@error: -2147352570
@extended: 0

  • Right! If you do not specify this parameters then the specified default values are used.
  • @error: -2147352570 means "DISP_E_UNKNOWNNAME". This is an error unhandled by the UDF and should show a messagebox. Is this correct?
  • If you run the _AD_CreateMailbox example script for a user that already has a mailbox does the form show the same results as you specify when you try to create a new message box (including the default parameters)?
  • If you run the _AD_ListExchangeServers example script is the first server in the list the exchange server where you want the mailbox to be created?
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

Right! If you do not specify this parameters then the specified default values are used.

@error: -2147352570 means "DISP_E_UNKNOWNNAME". This is an error unhandled by the UDF and should show a messagebox. Is this correct?

If you run the _AD_CreateMailbox example script for a user that already has a mailbox does the form show the same results as you specify when you try to create a new message box (including the default parameters)?

I haven't tried that yet. I'll have to create a different script to handle it since my test script checks for existing users before creating a new one (user provisioning).

Attached is a screenshot of my exchange manager as well.

post-55677-12765295245079_thumb.png

Edited by lgwapnitsky
Link to comment
Share on other sites

I haven't tried that yet. I'll have to create a different script to handle it since my test script checks for existing users before creating a new one (user provisioning).

Attached is a screenshot of my exchange manager as well.

Sorry, I wasn't clear enough.

Just start the _AD_CreateMailbox example script until the GUI is displayed, copy the screen (so we can check the default values) and then exit.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

Could you please try

_AD_CreateMailbox($sAMAccountName, "Mailbox Store (" & $mailServer & ")","First Storage Group",$mailServer)
as the Storename changes on each server?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

Could you please try

_AD_CreateMailbox($sAMAccountName, "Mailbox Store (" & $mailServer & ")","First Storage Group",$mailServer)
as the Storename changes on each server?

Yes, the storename does change for each server. Also, my assumption above was incorrect. I've modified my code to state the following:

_AD_CreateMailbox($sAMAccountName, "Mailbox Store (" & $mailServer & ")", "First Storage Group", $mailServer, "First Administrative Group", "Wallace Roberts Todd")

I still receive the error.

Additionally, if I try to create the mailbox for the new user using the demo script, I receive the same error.

I forgot to upload my screencap before. Here it is with my username, which is reported as already having a mailbox (correct assumption).

post-55677-12765306236658_thumb.png

Link to comment
Share on other sites

oops...i think I found the issue. The Exchange Server Group. Can I use "-1" values in this implementation until I get to the variable I need to change?

No, you have to specify all default values until you get to the parameter you need to change.

According to the Autoit help file for the keyword "Default" :

"For UDF's, it is the scripter's responsiblity to check if the parameter has been set to Default and to perform the desired behavior in this situation."

This is not implemented in the AD UDF at the moment.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

Pffft ... I'm running out of ideas now.

Next (last) thing to try is some sort of debugging.

Can you please insert line

ConsoleWrite($sAD_Mailboxpath & @CRLF)
in front of line
$oAD_User.CreateMailbox($sAD_Mailboxpath)
in the _AD_CreateMailbox function and post the result?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

Pffft ... I'm running out of ideas now.

Next (last) thing to try is some sort of debugging.

Can you please insert line

ConsoleWrite($sAD_Mailboxpath & @CRLF)
in front of line
$oAD_User.CreateMailbox($sAD_Mailboxpath)
in the _AD_CreateMailbox function and post the result?

As requested:

LDAP://CN=Mailbox Store,CN=First Storage Group,CN=InformationStore,CN=PH-SVR-EXCH1,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=Wallace Roberts Todd,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=wrtdesign,DC=com
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...