Link to home
Start Free TrialLog in
Avatar of rkeith2412
rkeith2412Flag for United States of America

asked on

Pass HTML in Powershell object

I have a script that gathers info about VMs and outputs the data to an HTML file.  I want to add an HTML link as a property of the object so my output will include a link to a page with more detailed info.  
New-Object psobject -Property ([ordered]@{
        Name = $vm.Name
        Link = "<a href='$($vm.Name).html'>More Info</a>"
        State = if ($vm.PowerState -eq "PoweredOn") { "Running" } else { "Off" }
        vCPU = $vm.NumCpu
        RAM = "$([math]::Round($vm.MemoryGB)) GB"
    })

Open in new window

My issue is that Powershell sanitizes my HTML for output by converting < to &lt; so I am left with this
&lt;a href=&#39;ServerA.html&#39;&gt;More Info&lt;/a&gt;

Open in new window

instead of this
<a href='ServerA.html'>More Info</a>

Open in new window

Any help with getting Poweshell to pass the text as I intended would be greatly appreciated.
ASKER CERTIFIED SOLUTION
Avatar of rkeith2412
rkeith2412
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial