noobieautolearn Posted May 15, 2018 Share Posted May 15, 2018 (edited) 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? Edited May 15, 2018 by noobieautolearn Link to comment Share on other sites More sharing options...
water Posted May 16, 2018 Share Posted May 16, 2018 It would help if you could post your 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 More sharing options...
noobieautolearn Posted May 17, 2018 Author Share Posted May 17, 2018 (edited) 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 May 17, 2018 by noobieautolearn Link to comment Share on other sites More sharing options...
water Posted May 17, 2018 Share Posted May 17, 2018 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 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 More sharing options...
noobieautolearn Posted May 17, 2018 Author Share Posted May 17, 2018 (edited) 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? Edited May 17, 2018 by noobieautolearn Link to comment Share on other sites More sharing options...
water Posted May 18, 2018 Share Posted May 18, 2018 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 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 More sharing options...
rudi Posted May 18, 2018 Share Posted May 18, 2018 Hi @water Could you pls share the PS code you've mentioned? thx, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
water Posted May 18, 2018 Share Posted May 18, 2018 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 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 More sharing options...
noobieautolearn Posted May 18, 2018 Author Share Posted May 18, 2018 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 More sharing options...
water Posted May 18, 2018 Share Posted May 18, 2018 Then maybe function _AD_ModifyAttribute is the way to add those properties to a user? 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now