Splatting parameters

suggest change

Splatting replaces the dollar sign $ with @ on a variable that holds a hashtable of parameter names and values.

$MyParameters = @{
    Name = "iexplore"
    FileVersionInfo = $true
}

Get-Process @MyParameters

Without splatting:

Get-Process -Name "iexplore" -FileVersionInfo

You can combine normal parameters with splatted parameters to easily add common parameters to your calls.

$MyParameters = @{
    ComputerName = "StackOverflow-PC"
}

Get-Process -Name "iexplore" @MyParameters

Invoke-Command -ScriptBlock { "Something to execute remotely" } @MyParameters

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents