简体   繁体   中英

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. I'm guessing it won't work with the regular Powershell CLI either. 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.

To add the snap-in to any Powershell host, use the command Tomas mentioned:

Add-PSSnapin VMware.VimAutomation.Core

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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