Powershell html formatting using convertto-html cmdlet
This was took me a little bit to figure out, but I finally did. Wasn't able to find this solution on the web so I figure I would post what I had to do to make it work. I basically had a 'if else' statement that I wanted the return of an if statement to highlight in red and be bolded in html. Unfortunately, the convertto-html cmdlet converts '<' and '>' to html friendly formats for display like '<'and '>'.
So here is the key:
Afterwards, you can pipe to a file where the formatting you placed in your code stays intact.
So here is the key:
...code...
Convertto-Html
foreach {$_.replace("<","<").replace(">",">")}
Afterwards, you can pipe to a file where the formatting you placed in your code stays intact.
Comments