?
Solved

Powershell email - Need to have caarrage returns

Posted on 2014-03-05
2
Medium Priority
?
210 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
footech earned 2000 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

752 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