You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Intellisense: Splatting is treated as a positional parameter #3650
When splatting parameters onto a command, PowerShell assumes that the splat is taking the place of the first parameter. Therefore, when you attempt to auto-complete parameters, the first parameter is removed from the Intellisense list, even if that parameter doesn't appear in the Splatting HashTable.
For example, take a look at the first parameter of the Amazon Web Services (AWS) Get-ECSClusterService command. The first parameter is -Cluster.
However, when I splat a couple of "common parameters," specifically -Region and -ProfileName, you can see that -Cluster is removed from the Intellisense results.
When automating against AWS, I use the Intellisense list to build a second Splatting HashTable with service-specific parameters, and then Splat both the common parameters and the service-specific parameters. Hence, the missing parameter causes me a bit of grief. Minor annoyance. :)
### Define common parameters$Common=@{
ProfileName='awsprofile'Region='us-west-2'
}
### Define service-specific parameters$ECSService=@{
Cluster=$ECSCluster.ClusterNameServiceName='testservice'TaskDefinition='windows-test'DesiredCount=1
}
### Splat both common and service-specific parametersNew-ECSService@Common@ECSService
Activity