Jump to content

Active Directory UDF Email issue


Recommended Posts

I was working with ADU and I was trying to get the email address function to work but when I try I end up with the error message as seen in the attachment. I did some searching and found out that this means "unknown error". Water said that that means I might not have write access to AD but I can assure you that I am running the script with a domain admin account and the other strange thing is, if I run this test script on another account that existed before it does work.  Has any run into issues with not being able to set the email address of an account that they created with ADU?

Active Directory UDF.png

Edited by noobieautolearn
Link to comment
Share on other sites

It would help if you could post your script.

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

20 hours ago, water said:

It would help if you could post your script.

I'm just using the sample script to add an email address that came in the zip file.

 

_AD_AddEmailAddress.au3

Does the command check any attributes and if it isn't set it won't add the email address?

 

Edited by noobieautolearn
Link to comment
Share on other sites

A COM error handler returns better results. Please add the following line at the top of your script:

_AD_ErrorNotify(2)

This will write detailed error information to a MsgBox.

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

11 hours ago, water said:

A COM error handler returns better results. Please add the following line at the top of your script:

_AD_ErrorNotify(2)

This will write detailed error information to a MsgBox.

Ok, I ran it and I attached the error I got below. Also note that I have used this same sample script successfully on other AD accounts but so far the one I created with ADU has not worked and I have tried this on some other accounts that currently don't have email addresses attached and they haven't worked either.

What I'm going to do is set the email, emailnick, proxy and target and try the same account to see if I get errors.

 

So I have sort of figured out what is going on, if I go into the account and add a mail attribute and a proxy address attribute the script works.  So then that brings up the question I have is, if I want to use your suite (thank you for creating it) to create a brand new user and I want to of course have all the attributes filled in during the creation process including mail, mailnick, proxyaddress and target address what would I need to do?  Or should that Add email address example script work even if none of those attributes are filled out?

 

 

AD error2.png

Edited by noobieautolearn
Link to comment
Share on other sites

That's exactly what happens. You can add an "SMTP email address to the 'Email Addresses' tab of an Exchange-enabled AD account."
Means: You first have to create th mailbox, then you can add further addresses.
In my company we use a PowerShell script to create the mailbox. If needed I can share this script.

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

Snippet of my script to create new users for Exchange 2016:

Global $hFile = FileOpen(@ScriptDir & "\NewEmployee.ps1", $FO_OVERWRITE)
    FileWrite($hFile, _
            "$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://YourExchangeServerNameGoesHere.CompanyName.com/PowerShell/ -Authentication Kerberos" & @CRLF & _
            "Import-PSSession $Session" & @CRLF & _
            "Enable-Mailbox -Identity " & $sUserID & " -Alias " & $sUserID & @CRLF & _
            "Remove-PSSession $Session" & @CRLF)
    FileClose($hFile)
    $sCMD = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -file " & @ScriptDir & "\NewEmployee.ps1"
    $pid = Run($sCMD, @SystemDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD + $STDERR_CHILD)
    StdinWrite($pid, @CRLF)
    StdinWrite($pid)
    ; Process STDOUT
    $sSTDOUT = ""
    While 1
        $sOutput = StdoutRead($pid)
        If @error Then ExitLoop
        If $sOutput <> "" Then $sSTDOUT = $sSTDOUT & @CRLF & $sOutput
    WEnd
    ; Process STDERR
    $sSTDERR = ""
    While 1
        $sOutput = StderrRead($pid)
        If @error Then ExitLoop
        If $sOutput <> "" Then $sSTDERR = $sSTDERR & @CRLF & $sOutput
    WEnd
    If StringStripWS($sSTDERR, 3) = "" Then
        _FileWriteLog($sLogFile, "I (" & @AutoItPID & ") " & $sUserID & ": Mailbox successfully created.")
    Else
        Exit _Error("Error creating Exchange mailbox!" & @CRLF & $sSTDERR)
    EndIf

 

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

6 hours ago, water said:

Snippet of my script to create new users for Exchange 2016:

Global $hFile = FileOpen(@ScriptDir & "\NewEmployee.ps1", $FO_OVERWRITE)
    FileWrite($hFile, _
            "$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://YourExchangeServerNameGoesHere.CompanyName.com/PowerShell/ -Authentication Kerberos" & @CRLF & _
            "Import-PSSession $Session" & @CRLF & _
            "Enable-Mailbox -Identity " & $sUserID & " -Alias " & $sUserID & @CRLF & _
            "Remove-PSSession $Session" & @CRLF)
    FileClose($hFile)
    $sCMD = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -file " & @ScriptDir & "\NewEmployee.ps1"
    $pid = Run($sCMD, @SystemDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD + $STDERR_CHILD)
    StdinWrite($pid, @CRLF)
    StdinWrite($pid)
    ; Process STDOUT
    $sSTDOUT = ""
    While 1
        $sOutput = StdoutRead($pid)
        If @error Then ExitLoop
        If $sOutput <> "" Then $sSTDOUT = $sSTDOUT & @CRLF & $sOutput
    WEnd
    ; Process STDERR
    $sSTDERR = ""
    While 1
        $sOutput = StderrRead($pid)
        If @error Then ExitLoop
        If $sOutput <> "" Then $sSTDERR = $sSTDERR & @CRLF & $sOutput
    WEnd
    If StringStripWS($sSTDERR, 3) = "" Then
        _FileWriteLog($sLogFile, "I (" & @AutoItPID & ") " & $sUserID & ": Mailbox successfully created.")
    Else
        Exit _Error("Error creating Exchange mailbox!" & @CRLF & $sSTDERR)
    EndIf

 

We have office 365 and don't use on prem exchange.  What we need to do is create an account with mail, mailnick, proxyaddresses and target and it gets imported to our O365 portal where it gets licensed.

Link to comment
Share on other sites

Then maybe function _AD_ModifyAttribute is the way to add those properties to a user?

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

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
 Share

  • Recently Browsing   0 members

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