Skip to content

Get-Command doesn't recognize System.Management.Automation.CommandInfo (its own output type) as pipeline input #10851

@mklement0

Description

@mklement0

Feeding Get-Command output to itself via the pipeline - useful if you want to force loading of all modules in the context of reflection - doesn't work as expected.

It looks like a new parameter set with a System.Management.Automation.CommandInfo-typed parameter would have to be introduced to support that.

Steps to reproduce

# OK
('Add-Content', 'Get-Content' | Get-Command).Name | Should -Be 'Add-Content', 'Get-Content'

# Fails
(Get-Command 'Add-Content', 'Get-Content' | Get-Command).Name | Should -Be 'Add-Content', 'Get-Content'

Expected behavior

Both tests should succeed.

Actual behavior

The 2nd test fails, because the only CommandInfo object output is the one for Add-Content

Expected @('Add-Content', 'Get-Content'), but got 'Add-Content'

Environment data

PowerShell Core 7.0.0-preview.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Committee-ReviewedPS-Committee has reviewed this and made a decisionIssue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.WG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions