Skip to content

Allow -JobName and -HostName parameters in Invoke-Command #11443

@TylerLeonhardt

Description

@TylerLeonhardt

Summary of the new feature/enhancement

I feel like this leans on the bug category... but I suppose it is a feature...

Today, you can't use -HostName and -JobName together in the same call to Invoke-Command.

PS > Invoke-Command -ScriptBlock { gci } -AsJob -HostName localhost -JobName foo
Invoke-Command: Parameter set cannot be resolved using the specified named parameters. One or more parameters issued cannot be used together or an insufficient number of parameters were provided.

Once I get rid of -JobName it works:

PS > Invoke-Command -ScriptBlock { gci } -AsJob -HostName localhost

Id     Name            PSJobTypeName   State         HasMoreData     Location             Command
--     ----            -------------   -----         -----------     --------             -------
5      Job5            RemoteJob       Running       True            localhost             gci

Proposed technical implementation details (optional)

Could this be as easy as allowing JobName parameter with this parameter set?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugWG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core moduleWG-RemotingPSRP issues with any transport layer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions