I have a powershell script ,
[System.Net.ServicePointManager]::SecurityProtocol = 'TLS12'
$Mail_to="[email protected]"
$Mail_from="[email protected]"
$Subject = "Test"
$Body = "Test Body"
$SMTPServer = "smtp.sendgrid.com"
Send-MailMessage -SmtpServer $SMTPServer -Port 587 -UseSsl -From $Mail_from -To $Mail_to -Subject $Subject -BodyAsHtml $body -Encoding ([System.Text.Encoding]::UTF8)
Now i want the $subject and $Body value to be obtained from a batch file and run the powershell script using that batch file, How to do it?
-Subjectand-Body) to your script, then call it like this:MyScript.ps1 -Subject "some text" -Body "more text". More info here: about_Functions