Skip to content

In-line splatting #17706

@saladproblems

Description

@saladproblems

Summary of the new feature / enhancement

Currently you must define a variable to splat parameters to a command. Allow splatting a hashtable directly.

This could simplify syntax and reduce mistakes from splatting in loops where the current loop fails to update the splatted variable and the wrong iteration's parameters are applied.

Additionally, it may to provide parameter tab completion for an in-line splat than a variable defined before the function is called.

Proposed technical implementation details (optional)

Invoke-Command @{
    ComputerName = 'computer1','computer2','computer3'
    ScriptBlock = { 'my name is {0}' -f $env:computername }
    ErrorAction = 'stop'
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions