PowerShell Pass Named parameters to ArgumentList

前端 未结 7 1841
没有蜡笔的小新
没有蜡笔的小新 2021-02-20 08:14

I have a PowerShell script that accepts 3 named parameters. Please let me know how to pass the same from command line. I tried below code but same is not working. It assigns the

7条回答
  •  心在旅途
    2021-02-20 08:51

    Use a hashtable :

    icm -ComputerName test -ScriptBlock{$args} -ArgumentList @{"p1"=1;"p2"=2;"p3"=3} 
    

提交回复
热议问题