Author Posts

August 20, 2015 at 12:58 am

Dear All
I need some help with my script. I have script that checks the hypervisor connection on each xendesktop sites and stores the information in to a ps object and then I am trying to convert that object in to html where i have problem .

foreach ($Adminserver in $Adminservers){
$hypervischeck = Get-BrokerHypervisorConnection -AdminAddress $Adminserver | Select-Object Name,State
$HypervisorStatus  += New-Object psobject -Property @{Sitename = $Adminserver 
                                              HypervisorName = $hypervischeck.Name
                                              Status = $hypervischeck.State

====================================================
$hypervisorstuats contains the below details
itename Status Hypervisroname
——– ——
site1.exmaple.COM {On, On, On} {hyp1,hyp2,hyp3}
site2.example.COM {On, Unavailable, On} {hyp4,hyp5}
============================================================

I get the below content in my html , the status object is showing as system.object[].

Get-Content C:\temp\test.html

Sitename Status HypervisorName
site1.example.comSystem.Object[]System.Object[]
site2.example.comSystem.Object[]System.Object[]

August 20, 2015 at 1:04 am

Hi Suresh,

Check out our free ebook "Creating HTML Reports In PowerShell" for ideas and may be the solution to your problem.

https://www.penflip.com/powershellorg/creating-html-reports-in-powershell

Best,
Daniel

August 20, 2015 at 1:09 am

Hi Daniel
Thanks for the reference , Actually i am using his module and i get the error and i tried to check if i have the similar error in convertohtml .

$HypervisorStatus | ConvertTo-EnhancedHTMLFragment -TableCssID XDTabke ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (@{Sitename=TYOR...ystem.Object[]}:PSObject) [ConvertTo-EnhancedHTMLFragment], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,ConvertTo-EnhancedHTMLFragment

ConvertTo-EnhancedHTMLFragment : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its
properties do not match any of the parameters that take pipeline input.