PowerShell Splatting Passing a Switch parameter using Splatting


Example

To use Splatting to call Get-Process with the -FileVersionInfo switch similar to this:

Get-Process -FileVersionInfo

This is the call using splatting:

$MyParameters = @{
    FileVersionInfo = $true
}

Get-Process @MyParameters

Note: This is useful because you can create a default set of paramaters and make the call many times like this

$MyParameters = @{
    FileVersionInfo = $true
}

Get-Process @MyParameters -Name WmiPrvSE
Get-Process @MyParameters -Name explorer