我已经看过几条类似的消息,但到目前为止我所阅读的建议都没有解决我的错误。 chefboot_win.psq是一个脚本,我试图在这样的远程服务器上执行 -
PS C:\WINDOWS\system32> icm {param($lanID,$passW) C:\chefboot_win.ps1 @PSBoundParameters} -ArgumentList "userid", "password" -cn 10.XX.XX.XXX -Credential administrator
这是我在弹出窗口中输入管理员密码后出现的错误。
The term 'C:\chefboot_win.ps1' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
+ CategoryInfo : ObjectNotFound: (C:\chefboot_win.ps1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
+ PSComputerName : 10.XX.XX.XXX
当我不使用params并硬编码$ lanID和$ passW的值时,脚本运行正常。有人可以帮忙解释为什么这不起作用?谢谢!
答案 0 :(得分:0)
您可以使用以下语法执行其他脚本:
.\MyScript.ps1
或者,如果你有绝对的完整路径:
& "C:\location of my Script.ps1"