ConvertTo-HTML changing output

Welcome Forums General PowerShell Q&A ConvertTo-HTML changing output

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

3 years, 11 months ago.

  • Author
  • #24077

    Points: 0
    Rank: Member

    Hello! I am pulling health data from a HP server using GWMI and it brings back the expected data if I just run ir, but when I go to use ConvertTo-HTML the info changes. Here is the code I am using;

    gwmi HP_PowerSupply -Namespace root/HPQ | where-object {$_.DeviceID -eq 'Power Supply 2'} | Select StatusDescriptions

    This yields

    {Power Supply is operating properly}

    When I add a pipe and ConvertTo-HTML -Fragment the output changes to


    So the column header changes to just an * and the actual data is now System.String[]

    Ideas? Thanks!!


  • #24079

    Points: 256
    Helping Hand
    Rank: Contributor

    ConvertTo-HTML -Fragment is expecting string but is getting an object. Try:

    (gwmi HP_PowerSupply -Namespace root/HPQ | where-object {$_.DeviceID -eq 'Power Supply 2'}).StatusDescriptions

    and pipe that to ConvertTo-HTML -Fragment

  • #24084

    Points: 0
    Rank: Member

    Thanks!!! I also found out I could bracket the StatusDesccriptions. Once I thought about it that is what I figured was happening.


The topic ‘ConvertTo-HTML changing output’ is closed to new replies.

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