Soldato
Hmm;
So I'm creating a string array via:
And then insert into via:
This outputs as follows:
Great; now I'm trying to send the array as a body of an email via:
OK; so that fowls up; so I've tried to expand it via
This inserts the array into the body but the output is space delimetered. I want to by line item like how it outputs to the console. So I try to create a $body via:
and then:
Same output, the string array is space delimetered
I've tried! Any pointers would greatly appreciated!
Thanks Paul.
EDIT - So I was seemingly doing everything right?
I actually wanted to prefix the output with a timestamp and as soon as I did that, it outputted by line. eh
So I'm creating a string array via:
Code:
$StringArray = New-Object System.Collections.Generic.List[System.Object]
Code:
$StringArray.Add("Process execution times. $Server. Duration $Duration minutes")
}
Code:
Process execution times. uk1FLNW00005. Duration 00:00:22.0870471 minutes
Process execution times. uk1FLNW00006. Duration 00:00:21.6151800 minutes
Process execution times. uk1FLNW00222. Duration 00:00:23.0497878 minutes
Process execution times. uk1FLNW00223. Duration 00:00:22.3593577 minutes
Process execution times. uk1FLNW00224. Duration 00:00:22.3891550 minutes
Process execution times. us1FLNW00037. Duration 00:00:16.9704932 minutes
Process execution times. us1FLNW00038. Duration 00:00:18.0182680 minutes
Process execution times. us1FLNW00320. Duration 00:00:17.9848608 minutes
Process execution times. us1FLNW00321. Duration 00:00:17.6563677 minutes
Process execution times. us1FLNW00323. Duration 00:00:17.7638242 minutes
Code:
Send-MailMessage -To $to -From "[email protected]" -Priority low -Subject "$MailSubject Execution timings." -Body $StringArray -smtpServer "smtp.com"
Code:
$StringArrayClean | out-string
Send-MailMessage -To $to -From "[email protected]" -Priority low -Subject "$MailSubject Execution timings." -Body $StringArrayclean -smtpServer "smtp.com"
Code:
$body = @"
Execution Timings
Items:
$StringArrayClean
Total execution time : $TotalExecutionTime minutes
"@
Code:
Send-MailMessage -To $to -From "[email protected]" -Priority low -Subject "$MailSubject Execution timings." -Body $body -smtpServer "smtp.com"
I've tried! Any pointers would greatly appreciated!
Thanks Paul.
EDIT - So I was seemingly doing everything right?
I actually wanted to prefix the output with a timestamp and as soon as I did that, it outputted by line. eh
Last edited: