PowerShell Splatting Splatting parameters


Example

Splatting is done by replacing the dollar-sign $ with the splatting operator @ when using a variable containing a HashTable of parameters and values in a command call.

$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 excute remotely" } @MyParameters