Reputation: 975
I'm trying to build a hashtable in my script. Input is a parameter:
Param
(
[hashtable]$param
)
calling my function: Foobar -Param 'Key, value'
does not work. Also tried:
Foobar -Param 'Key' = 'Value';
Foobar -Param Key Value
Error returned: Cannot convert value of type "System.String" to type "System.Collections.Hashtable".
How do I pass the arguments correctly?
Upvotes: 1
Views: 1804
Reputation: 174485
Use a hashtable literal @{}
:
Foobar -Param @{ Key = 'Value' }
Upvotes: 1