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 '&lt;'and '&gt;'.

So here is the key:

foreach {$_.replace("&lt;","<").replace("&gt;",">")}

Afterwards, you can pipe to a file where the formatting you placed in your code stays intact.


Anonymous said…
Thanks a lot..!! I had the same issue and your solution worked well..!!!

Popular posts from this blog

Misc: Navien NPE-240A Navilink App missing scheduling function

Macbook Pro OSX 10.5.x Sprint Blackberry 8830 Data Tethering

PowerCLI: The SSL connection could not be established, see inner exception.