Write powershell output to email body
I'm using this cmdlet to try to send an email which the body of email is contains the powershell output. PS C:\ps> Send-MailMessage -From postmaster@contoso.com -To suriya@sapura.contoso.com -Subject "SCR Test Result" -Body "SCR result + `n + $sr.summarycopystatus" -Smtpserver send.contoso.com The email was able to sent to my mailbox but the contents look like below: 2/8/2007 3:32 PM SERVER! Disk Space Report Disk Drive Size(GB) Free(GB) ---------- -------- -------- C:\ 8.01 2.98 E:\ 60.36 54.7 F:\ 150 143.41 SERVER2 Disk Space Report Disk Drive Size(GB) Free(GB) ---------- -------- -------- C:\ 7.96 4.61 E:\ 60.35 31.14 F:\ 68.35 48.03 SERVER3 Disk Space Report Disk Drive Size(GB) Free(GB) ---------- -------- -------- C:\ 7.81 4.61 E:\ 60.51 46.44 F:\ 136.7 111.81 G:\ 136.7 128.64 H:\ 136.7 66.13 I:\ 136.7 Please help to array in more readable format
April 12th, 2011 4:34am

Hi Suriya25, I would suggest you seek the solution in the Windows Powershell Forum: http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/threads Just for reference: Send-MailMessage http://technet.microsoft.com/en-us/library/dd347693.aspxPlease remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
April 13th, 2011 5:02am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics