简体   繁体   English

使用SoapUI运行VMWare powerCLI命令

[英]Running VMWare powerCLI commands with SoapUI

I have a powershell script file with PowerCLI commands like Connect-VIServer etc. I am able to run the script file in PowerGUI after I added the library references to VMWare PowerCLI but I don't know how to run it through SoapUI. 我有一个PowerShell脚本文件与PowerCLI命令,如Connect-VIServer等。我添加库引用VMWare PowerCLI后,我能够在PowerGUI中运行脚本文件,但我不知道如何通过SoapUI运行它。 I'm guessing it won't work with the regular Powershell CLI either. 我猜它也不适用于常规的Powershell CLI。 Is there any way to make this work? 有没有办法让这项工作? Here's the error, if it helps: 这是错误,如果它有帮助:

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

You cannot execute PowerCLI commands outside of a Powershell host. 您无法在Powershell主机之外执行PowerCLI命令。

To add the snap-in to any Powershell host, use the command Tomas mentioned: 要将管理单元添加到任何Powershell主机,请使用提到的Tomas命令:

Add-PSSnapin VMware.VimAutomation.Core

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM