Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

select-string format - new line for each string in email body

$
0
0

Hey scripting guys,

I am an amateur at powershell at the best of times. But here we go.

I need to change the formatting of an output so that it displays a new string on each line.

Here's the part of my script that's important. 


$info = select-string -Path c:\power\test\test.txt "test" | ForEach-Object {$_.Line}

$strBody =@" 

The OSD Task Sequence has completed for $strcomputer at $time   

* Completed Successfully *

More information:$info"@ 

This will retrieve some information from the logs about a task sequence process.

This information is then emailed to myself so i can track status of different sequences without being onsite. 

Within powershell it displays each item on a new line

when this is emailed it puts it all on one line.

More information:

test 1 test 2 test 3 test 4

This may seem insignificant but i am hoping to use this to display more than 4 options once i can get it working.

How to i separate it, so that, when i receive the email it will be displayed with the same formatting as the powershell window.

I would like it to display as below

More information:

test 1

test 2

test 3

test 4

Sorry if this is a little vague or using incorrect terms.


Clinton Mohoupt




Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>