首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用SoapUI运行VMWare powerCLI命令

使用SoapUI运行VMWare powerCLI命令
EN

Stack Overflow用户
提问于 2012-07-20 02:47:05
回答 2查看 15K关注 0票数 3

我有一个包含PowerCLI命令的powershell脚本文件,比如Connect-VIServer等。在我将库引用添加到VMWare PowerCLI之后,我可以在PowerGUI中运行该脚本文件,但我不知道如何通过SoapUI运行它。我猜它也不能与常规的Powershell CLI一起工作。有没有办法让这件事起作用呢?如果有帮助的话,下面是错误:

代码语言:javascript
复制
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
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-07-20 02:58:38

尝试在脚本的开头调用以下代码:

代码语言:javascript
复制
Add-PSSnapin "VMware.VimAutomation.Core" | Out-Null
票数 4
EN

Stack Overflow用户

发布于 2012-07-21 10:56:28

您不能在Powershell主机外部执行PowerCLI命令。

要将管理单元添加到任何Powershell主机,请使用前面提到的命令Tomas:

代码语言:javascript
复制
Add-PSSnapin VMware.VimAutomation.Core
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11567349

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档