I could not get krbtgt password reset script to send e-mail. I don't use ssl or smime signature and encryption. They also seemed to be optional if I looked at xml file. If I looked at the sendMailMessage function then as I understood it only sends email if \<mailsign> or \<mailencrypt> are ON or if \<sslType> is defined IMPLICIT or EXPLICIT. If smime options are off and ssltype is defined then it does not honor \<useSSLForSMTP> option which is set to FALSE and tries to send email with SSL. If \<sslType> is not defined then it does not send email at all. If it is intentional then documentation should be updated that you can send e-mail only with SSL or with smime options.
After some testing script sent email when useSSLForSMTP was FALSE, ssltype was EXPLICIT and smtpCredsUserName and smtpCredsPassword had value LEAVE_EMPTY_OR_LEAVE_AS_IS_OR_SPECIFY. If they were empty then script sent the email but error message was displayed:
ConvertTo-SecureString : Cannot bind argument to parameter 'String' because it is an empty string.
At C:\apps\scripts\Reset-KrbTgt-Password-For-RWDCs-And-RODCs.ps1:4994 char:110
+ ... mtpCredsUserName, $(ConvertTo-SecureString $smtpCredsPassword -AsPlai ...
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [ConvertTo-SecureString], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.ConvertToSecureStringCommand
After looking at it little more the last problem is because if smtpCreds... sections are empty then variable is not $null but empty string. If I added emptry string check to the if clause - "" -ne $smtpCreds... -And ... - then error message went away.
I could not get krbtgt password reset script to send e-mail. I don't use ssl or smime signature and encryption. They also seemed to be optional if I looked at xml file. If I looked at the sendMailMessage function then as I understood it only sends email if \<mailsign> or \<mailencrypt> are ON or if \<sslType> is defined IMPLICIT or EXPLICIT. If smime options are off and ssltype is defined then it does not honor \<useSSLForSMTP> option which is set to FALSE and tries to send email with SSL. If \<sslType> is not defined then it does not send email at all. If it is intentional then documentation should be updated that you can send e-mail only with SSL or with smime options.
After some testing script sent email when useSSLForSMTP was FALSE, ssltype was EXPLICIT and smtpCredsUserName and smtpCredsPassword had value LEAVE_EMPTY_OR_LEAVE_AS_IS_OR_SPECIFY. If they were empty then script sent the email but error message was displayed:
After looking at it little more the last problem is because if smtpCreds... sections are empty then variable is not $null but empty string. If I added emptry string check to the if clause - "" -ne $smtpCreds... -And ... - then error message went away.