给出一个哈希表列表
$adminprinters | ConvertTo-Json
[
{
"Brand": "HP",
"IP": "10.8.200.200",
"Name": "Admin-Tech-HP4700"
},
{
"Brand": "HP",
"IP": "10.8.200.201",
"Name": "Admin-Tech-4015"
}
]
如何迭代该列表并将每个对象splat到cmdlet。例如,
foreach($h in $adminprinters){
Add-CustomPrinterModule @($h)
}
答案 0 :(得分:0)
括号和$必须省略。
foreach($h in $adminprinters){
Add-CustomPrinterModule @h
}