In the command "Send Email" There is a function defined which can tell you how to do it.
function ConvertFromSecureToPlain{
param(
[Parameter(Mandatory=$true)]
[System.Security.SecureString] $SecurePassword
)
# Create a "password pointer"
$PasswordPointer = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecurePassword)
# Get the plain text version of the password
$PlainTextPassword = [Runtime.InteropServices.Marshal]::PtrToStringAuto($PasswordPointer)
# Free the pointer
[Runtime.InteropServices.Marshal]::ZeroFreeBSTR($PasswordPointer)
# Return the plain text password
$PlainTextPassword
}
Call this using something like:
$myPassword = ConvertFromSecureToPlain -SecurePassword $myCredentials.Password
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.