EvotecIT / Testimo

Testimo is a PowerShell module for running health checks for Active Directory against a bunch of different tests
MIT License
526 stars 58 forks source link

Email report not working #119

Closed BigSap07 closed 1 year ago

BigSap07 commented 3 years ago

I'm using my email as the email from and also as the email too. So for Emailserver i took the smtp from my email and put it there and then i put again my email as username and the password that belongs to my email but i feel like i use a lot of my email here. May that be the problem that i get this?

False Exception calling "Send" with "1" argument(s): "Server does not support secure connections."

Script: $Results = Invoke-Testimo -ReturnResults -ExcludeDomains 'wilms.be'

Email { EmailHeader { EmailFrom -Address 'mave@wilms.be' EmailTo -Addresses "mave@wilms.be" EmailServer -Server 'smtp.office365.com' -UserName 'mave@wilms.be' -Password 'C:\PathToMyPassword' -PasswordAsSecure -PasswordFromFile -Port 587 -SSL EmailOptions -Priority High -DeliveryNotifications Never

PrzemyslawKlys commented 3 years ago

Most likely you have not the encrypted the password in the path to your password file. When you use PasswordAsSecure it needs to be of a proper format.

I usually use this cmdlet to save it: https://github.com/EvotecIT/PSMyPassword/blob/master/Public/Protect-MyPassword.ps1

jg00d3 commented 2 years ago

Most likely you have not the encrypted the password in the path to your password file. When you use PasswordAsSecure it needs to be of a proper format.

I usually use this cmdlet to save it: https://github.com/EvotecIT/PSMyPassword/blob/master/Public/Protect-MyPassword.ps1

I'm trying to figure out how to create the password file but not getting it. I've installed the powershell module: Install-Module -Name PSMyPassword -AllowClobber -Force Then I run "Protect-MyPassword -Username 'test@test.com' but I get an error: Protect-MyPassword : A parameter cannot be found that matches parameter name 'Username'. At line:1 char:20

Not sure what I'm doing wrong and I can't find instructions on how to create this properly formatted file that is called. Can you please let me know how to create it?

PrzemyslawKlys commented 2 years ago

Hi,

image

Something like this should work. You can either pass the directly password without the PasswordFromFile switch or with PasswordFromFile and it should work.

Keep in mind that this password encryption is done using DPAPI. This means it works for a given session. So if you encrypt it while you develop stuff and decide on scheduling it with a different account, you need to do the same thing using that other account (for example using psexec).