Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Help! Securing Password in Powershell Email Script

$
0
0

Hi All,

 

I'm new at Powershell and having some difficulty with this script below. I cant seem to find a way to run this script without storing the password in the script for my account. I do not want to use the Powershell email cmdlet. 

 

$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587) 

$Body1 = (get-content C:\users\Failure.htm) 

$SMTPClient.EnableSsl = $true

$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("username,"Password" ); 

$message = New-Object Net.Mail.MailMessage($EmailFrom, $EmailTo, $Subject, $Body1)

$message.IsBodyHtml = $true;


Viewing all articles
Browse latest Browse all 6937

Trending Articles