Scenario: A variable stores a value that has HTML tags. You wish to remove all the HTML tags from the variable but keep the content.
Example: Running the following will store the internal message of Out of Office in the variable $1.
$1 = (Get-mailboxautoreplyconfiguration steve).internalmessage
When displaying $1, it looks like this:
<font size=”2″><span style=”font-size:10pt;”><div class=”PlainText”>Steve has left the building. He is never coming back .<br>
$1 = $1 -replace ‘<[^>]+>’,”
When displaying $1, it will now look like this:
Steve has left the building. He is never coming back.