我有一切就位,至少我認爲是這樣。我想給自己發送Get-WmiObject win32命令的輸出。例如:得到wmiobject的win32:我如何通過電子郵件的輸出
$OS = "."
(Get-WmiObject Win32_OperatingSystem).Name |Out-String
$secpasswd = ConvertTo-SecureString "mypassword" -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential
("[email protected]", $secpasswd)
Send-MailMessage -To "[email protected]" -SmtpServer
"smtp.office365.com" -Credential $mycreds -UseSsl "Backup Notification" -
Body $body -From "[email protected]"
我曾嘗試以下:
$body = (
Write-Host "Computer Info:" -Message $PCinfo
) -join "`r`n"
Write-Verbose -Message $body
返回錯誤:「在‘身體’參數無法驗證論點的論據是null或空。」
任何方向,建議或例子,將不勝感激。 謝謝
謝謝每個人的幫助! – Wchristner