Skip to content

Add -ExcludeProperty to Format-* cmdlets #25043

@surfingoldelephant

Description

@surfingoldelephant

Summary of the new feature / enhancement

As a PowerShell user, I would like the ability to exclude properties displayed by format cmdlets such as Format-Table, without requiring an intermediate command or use of -Property.

For example:

$obj = [pscustomobject] @{ 1 = 1; 2 = 2; 3 = 3; 4 = 4; 5 = 5; 6 = 6 } 

# Currently, the simplest approach to exclude a property 
# requires an intermediate call to Select-Object.
$obj | Select-Object -ExcludeProperty 3 | Format-Table

# Feature request:
$obj | Format-Table -ExcludeProperty 3

Format-Table, Format-List and Format-Custom already provide a means to opt into selected properties while excluding all others (via -Property).

For convenience and consistency with Select-Object, I would like the three cmdlets listed above to support the inverse (opt out of selected properties while including all others), by implementing an -ExcludProperty parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugKeepOpenThe bot will ignore these and not auto-closeResolution-FixedThe issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility moduleWG-ReviewedA Working Group has reviewed this and made a recommendation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Reviewed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions