XA-and-XD-HealthCheck
XA-and-XD-HealthCheck copied to clipboard
send email not working as expected
Receiving the following at the end of execution. I ran the code to generate the password hash and placed it in the xml, configured my smtp information and username as well.
`Saving results to html report: C:\Temp\CTXXDHealthCheck.htm ConvertTo-SecureString : Input string was not in a correct format. At C:\Temp\XA-and-XD-HealthCheck.ps1:1528 char:20
-
$pass = $smtpPW | ConvertTo-SecureString -key $smtpKey
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (:) [ConvertTo-SecureString], FormatException
- FullyQualifiedErrorId : System.FormatException,Microsoft.PowerShell.Commands.ConvertToSecureStringCommand
The variable '$pass' cannot be retrieved because it has not been set. At C:\Temp\XA-and-XD-HealthCheck.ps1:1529 char:73
-
$cred = New-Object System.Management.Automation.PsCredential($smtpUser,$pass)
-
~~~~~
- CategoryInfo : InvalidOperation: (pass:String) [], RuntimeException
- FullyQualifiedErrorId : VariableIsUndefined
The variable '$cred' cannot be retrieved because it has not been set. At C:\Temp\XA-and-XD-HealthCheck.ps1:1531 char:82
- ... TaskMemUnicode($cred.Password)
-
~~~~~
- CategoryInfo : InvalidOperation: (cred:String) [], RuntimeException
- FullyQualifiedErrorId : VariableIsUndefined
The variable '$cred' cannot be retrieved because it has not been set. At C:\Temp\XA-and-XD-HealthCheck.ps1:1532 char:18
-
$smtpUserName = $cred.Username
-
~~~~~
- CategoryInfo : InvalidOperation: (cred:String) [], RuntimeException
- FullyQualifiedErrorId : VariableIsUndefined
The variable '$Ptr' cannot be retrieved because it has not been set. At C:\Temp\XA-and-XD-HealthCheck.ps1:1533 char:75
-
$smtpPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($Ptr)
-
~~~~
- CategoryInfo : InvalidOperation: (Ptr:String) [], RuntimeException
- FullyQualifiedErrorId : VariableIsUndefined
The variable '$smtpUserName' cannot be retrieved because it has not been set. At C:\Temp\XA-and-XD-HealthCheck.ps1:1535 char:69
-
$smtpClient.Credentials = New-Object System.Net.NetworkCredential( $smtpUserNam ...
-
~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (smtpUserName:String) [], RuntimeException
- FullyQualifiedErrorId : VariableIsUndefined
Exception calling "Send" with "1" argument(s): "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at" At C:\Temp\XA-and-XD-HealthCheck.ps1:1538 char:1
- $smtpClient.Send( $emailMessage )
-
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : SmtpException`