Get-WindowsFeature - Fancy organized Display Name output

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Don Jones Don Jones 5 months, 1 week ago.

  • Author
    Posts
  • #45291
    Profile photo of Brian B
    Brian B
    Participant

    This might not be possible, but I really dislike when you run a command like below... and get nice looking tree-structured looking results for 'Display Name' because of some trickery in the background built-into the command.

    Get-WindowsFeature | Where-Object { $_.Installed -match "True" }

    Now, I know 'Display Name' is not a valid property/column/etc... but that's how it's displayed... only it's being cut off because the length of the text is too long. But if you JUST display the 'DisplayName', it's no longer formatted in a tree-like structure with X's. I literally want to display the Display Name only, in the console, with the nice looking structure showing what features are sub-items of another feature, but I don't see a way to do that.

    Any thoughts there? Am i missing some obvious formatting option? I use the data returned in all sorts of scripts, but in this ONE instance, I want to actually display it to a user and i thought i'd make it look nice like that instead of just a static list.

    Thanks in advance

    Brian

  • #45297
    Profile photo of Don Jones
    Don Jones
    Keymaster

    That's done by a custom view, in a PS1XML file stored with the module. Any manual formatting you specify negates the view. To do what you want, you'd have to make an overriding view. We cover those in "PowerShell In Depth," actually.

You must be logged in to reply to this topic.