[英]Running VMWare powerCLI commands with SoapUI
我有一个PowerShell脚本文件与PowerCLI命令,如Connect-VIServer等。我添加库引用VMWare PowerCLI后,我能够在PowerGUI中运行脚本文件,但我不知道如何通过SoapUI运行它。 我猜它也不适用于常规的Powershell CLI。 有没有办法让这项工作? 这是错误,如果它有帮助:
The term 'Connect-VIServer' is not recognized as the name of a cmdlet, function
, script file, or operable program. Check the spelling of the name, or if a pat
h was included, verify that the path is correct and try again.
At Test.ps1:10 char:23
+ $vm = Connect-VIServer <<<< -Server $vcenterIP -User $vcenterUser -Password
$vcenterPW
+ CategoryInfo : ObjectNotFound: (Connect-VIServer:String) [], Co
mmandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
尝试在脚本的开头调用它:
Add-PSSnapin "VMware.VimAutomation.Core" | Out-Null
您无法在Powershell主机之外执行PowerCLI命令。
要将管理单元添加到任何Powershell主机,请使用提到的Tomas命令:
Add-PSSnapin VMware.VimAutomation.Core
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.