【发布时间】:2017-05-09 15:00:55
【问题描述】:
至少我是这么认为的。我想通过电子邮件向自己发送 Get-WmiObject win32 命令的输出。示例:
$OS = "."
(Get-WmiObject Win32_OperatingSystem).Name |Out-String
$secpasswd = ConvertTo-SecureString "mypassword" -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential
("support@myemail.com", $secpasswd)
Send-MailMessage -To "support@myemail.com" -SmtpServer
"smtp.office365.com" -Credential $mycreds -UseSsl "Backup Notification" -
Body $body -From "support@myemail.com"
我尝试了以下方法:
$body = (
Write-Host "Computer Info:" -Message $PCinfo
) -join "`r`n"
Write-Verbose -Message $body
返回错误:“无法验证参数'Body'上的参数。参数为空或空。”
我们将不胜感激任何方向、建议或示例。 谢谢
【问题讨论】:
标签: powershell email office365 get-wmiobject