Wrong Data in the Output data*:

Welcome Forums General PowerShell Q&A Wrong Data in the Output data*:

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

3 years, 4 months ago.

  • Author
  • #28780

    Points: 0
    Rank: Member

    Ok, I'm new to powershell and I'm doing a basic task.

    #creating a new collection of object – blank canvas
    $debugIISObj = New-Object -TypeName psobject

    #add new object
    Add-Member -InputObject $debugIIS Obj -MemberType NoteProperty -Name "Status" -Value "NON-COMPLIANT"

    Write-Output $debugIISObj

    put it to an html format

    $debugIISObj |ConvertTo-Html -Fragment -As List -PreContent "Debegug"

    but I get this instead



    It should be

    what's the problem with this?, why I'm getting this result?

    simple scrit

  • #28785

    Points: 1,704
    Helping HandTeam Member
    Rank: Community Hero

    Try adding "-Property Status" to your ConvertTo-HTML. You'll probably only notice this in cases where you've produced an object that has only one property. If you had added another property, it would work as you expected.

  • #28788

    Points: 0
    Rank: Member

    Thanks – That worked!

The topic ‘Wrong Data in the Output data*:’ is closed to new replies.