Can I do this better?


Back again ‘re-purposing’ (or as I like to call it ‘screwing it up for my own purposes’) another script in my quest for learning and world domination.

In essence I have a css style assigned to $Style for use with ConvertTo-HTML. The script goes away and collects some info which it puts into an variable called $Var. A separate variable called $Table is created and the following create a $Body variable which is used to as body text for an email.
$Body = $Var | Select $Table | ConvertTo-HTML -head $Style

What I want to do is add some text above the table and format with the predefined $Style.
I have tried this:
$BodyTable = $ItaniumUpdates | Select $Table | ConvertTo-HTML -head $Style
$Body = “Some text here.” + $BodyTable

but this doesn’t format the “Some text here.” according to style

How do I add the text to the email before the table and still format it?

Yes, use the -body parameter
$Body = $Var | Select $Table | ConvertTo-HTML -head $Style -boby"Some text here."
Love it that I’ve answered my own question!!!

If you wrap your text in an HTML element, like a div, you can apply a class to it and then format that class in your css.