我在我的部署过程中运行了几种不同类型的验证。对于每个验证,我想将一些 html 代码添加到数组中。在脚本的最后,我想取出整个代码数组并通过电子邮件发送出去。
我目前必须发送电子邮件的代码如下
$sendMessage = @{
Subject = "Problem: Web Config Blanks"
Body = "
<p>The Deployment Validation script has found at least 1 problem</p>
<UL>
<LI> There are " + $errorWcBlanksCt + " web config values that are blank
</UL>"
From = "from@company.com"
To = "to@company.com"
SmtpServer = "0.0.0.0"
}
send-mailmessage @sendMessageWcBlanksCt -BodyAsHtml
Write-Host "Web config has been parsed and emailed"
显然,这只是用于检查 web.configs 中的空白值的验证。例如,如果我要添加对总文件数的验证,我怎么能有一个额外的<LI>
行,但前提是文件数是脚本定义为“错误”的内容?