Solved

Powershell email - Need to have caarrage returns

Posted on 2014-03-05
2
207 Views
Last Modified: 2014-03-06
The email works but everything is run together. I need a new line at the end of both test lines, some lines in between the two sets and new lines for each line in the txt files.

Any suggestions?


-BodyAsHtml `
    -Body  @"
      The Following Were tested and are up and can be logged into
     $(((Get-Content C:\MonitorFolder\ServersUp.txt) | out-string)
      
      
       "The Following Were tested and are either DOWN or CANNOT be logged into"
       ((Get-Content C:\MonitorFolder\ServersDown.txt) | out-string))
"@
0
Comment
Question by:jimmylew52
2 Comments
 
LVL 40

Accepted Solution

by:
footech earned 500 total points
ID: 39908198
Either don't use the the -BodyAsHtml switch parameter, or remember that when you do use it your email is HTML and needs to be formatted accordingly.
An example with:
-BodyAsHtml `
    -Body  @"
      The Following Were tested and are up and can be logged into<br>
     $((Get-Content C:\MonitorFolder\ServersUp.txt) -join "<br>")
       <p>
       The Following Were tested and are either DOWN or CANNOT be logged into<br>
       $((Get-Content C:\MonitorFolder\ServersDown.txt) -join "<br>")
"@ 

Open in new window

0
 
LVL 1

Author Comment

by:jimmylew52
ID: 39909127
That worked. Thank You!!!!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question