Can anyone tell me how to add a parameter to my custom C# cmdlets which is a Hashtable/StringDictionary, so that I can call my cmdlet in a way which resembles this:
CustomCmdlet -File $someFilePath `
-StringDictionary/HashtableParameter @{
"name1"="value1"
"name2"="value2"
"name3"="value3"
...
}
I simply cannot find any documentation/example which clearly and simple explains how to do this, or if its even possible for custom cmdlets.
Can i just use:
[Parameter(Mandatory = false, Position = 9)]
public Dictionary<string,string> FieldValues { get; set; }
[Parameter(Mandatory = false, Position = 9)]
public HashTable FieldValues { get; set; }
...
Or something else?
Kind regards
You can use the following
public Hashtable[] SearchCriteria { get; set; }
to have the funcitonality like
Start-Process calc -PassThru | Get-UIAWindow | Get-UIAButton -SearchCriteria @{automationid="13*";name="[3-5]"},@{name="c*"},@{name="a*"},@{isenabled="false"} | Read-UIAControlName
The output is
4
Clear entry
5
Clear
3
Add
Maximize
Close
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With