I have a script that will send an email of the cluster status, but the output in the email body is off. How can I correct this to have it line up correctly or have it in a nice table format with borders?<\/p>\n
$cluster = Get-ClusterGroup | Out-file c:\\test.txt<\/p>\n
$body = [System.IO.File]::ReadAllText(“c:\\test.txt”)<\/p>\n
$MailMessage = @{ In the Email body it looks like this:<\/p>\n Name OwnerNode State<\/p>\n Available Storage NODE3 Online<\/p>\n Cluster Group NODE4 Online<\/p>\n INST01 NODE1 Online<\/p>\n INST02 NODE2 Online<\/p>\n INST03 NODE3 Online<\/p>\n INST04 NODE1 Online<\/p>","upvoteCount":8,"answerCount":4,"datePublished":"2022-06-30T15:15:54.000Z","author":{"@type":"Person","name":"Max1558","url":"https://community.spiceworks.com/u/Max1558"},"suggestedAnswer":[{"@type":"Answer","text":" I have a script that will send an email of the cluster status, but the output in the email body is off. How can I correct this to have it line up correctly or have it in a nice table format with borders?<\/p>\n $cluster = Get-ClusterGroup | Out-file c:\\test.txt<\/p>\n $body = [System.IO.File]::ReadAllText(“c:\\test.txt”)<\/p>\n $MailMessage = @{ In the Email body it looks like this:<\/p>\n Name OwnerNode State<\/p>\n Available Storage NODE3 Online<\/p>\n Cluster Group NODE4 Online<\/p>\n INST01 NODE1 Online<\/p>\n INST02 NODE2 Online<\/p>\n INST03 NODE3 Online<\/p>\n INST04 NODE1 Online<\/p>","upvoteCount":8,"datePublished":"2022-06-30T15:15:54.000Z","url":"https://community.spiceworks.com/t/send-email-of-powershell-output-in-correct-format/930096/1","author":{"@type":"Person","name":"Max1558","url":"https://community.spiceworks.com/u/Max1558"}},{"@type":"Answer","text":" If you post code, please use the ‘Insert Code’ button. Please and thank you!<\/p>\n
\nTo = “[email protected]<\/a>”
\nFrom = “[email protected]<\/a>”
\nSubject = “SQL Cluster Status”
\nBody = “$body”
\nSmtpserver = ‘blah.blah.local’
\nErrorAction = “SilentlyContinue”
\n}
\nSend-MailMessage @MailMessage<\/span><\/p>\n
\n
\nTo = “[email protected]<\/a>”
\nFrom = “[email protected]<\/a>”
\nSubject = “SQL Cluster Status”
\nBody = “$body”
\nSmtpserver = ‘blah.blah.local’
\nErrorAction = “SilentlyContinue”
\n}
\nSend-MailMessage @MailMessage<\/span><\/p>\n
\n