Need help converting PS object in to HTML

Welcome Forums General PowerShell Q&A Need help converting PS object in to HTML

This topic contains 2 replies, has 2 voices, and was last updated by

3 years, 9 months ago.

  • Author
  • #28795

    Topics: 15
    Replies: 24
    Points: 4
    Rank: Member

    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

  • #28796

    Topics: 2
    Replies: 525
    Points: 24
    Team Member
    Rank: Member

    Hi Suresh,

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


  • #28797

    Topics: 15
    Replies: 24
    Points: 4
    Rank: Member

    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.

The topic ‘Need help converting PS object in to HTML’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort