In PowerShell, what do you call the method used to pass a hash table to a cmdlet as an argument to give it parameters?
- Proping
- Slamming
- Hashing
- Splatting
EXPLANATION
Splatting can use either an array or a hash table, though it's typically used with a hash table. The hash table is built with the key names matching the parameter names for the cmdlet, and the values being filled out with the information to pass to the respective parameter. It's then passed as an argument to the cmdlet with the dollar ("$") decorator replaced with an at symbol ("@").Example:
$splat = @{ ParameterOne = 'Value to pass'; ParameterTwo = 'Another value'; ParameterThree = 'Still more values'; } Get-Cmdlet @splat # The above is equivalent to this: Get-Cmdlet -ParameterOne 'Value to pass' -ParameterTwo 'Another value' -ParameterThree 'Still more values'This method can be useful for making a cmdlet with a lot of parameters easier to manage. It can also be useful for logically adding and removing parameters as needed without having to call the cmdlet multiple times, which can lead to cleaner code and faster execution time.
https://technet.microsoft.com/en-us/library/jj672955.aspx