Solved

Powershell email - Need to have caarrage returns

Posted on 2014-03-05
2
204 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 39

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now