3

Connect-VIServerなどのPowerCLIコマンドを含むPowerShellスクリプトファイルがあります。VMWarePowerCLIへのライブラリ参照を追加した後、PowerGUIでスクリプトファイルを実行できますが、SoapUIを介して実行する方法がわかりません。通常のPowershellCLIでも動作しないと思います。これを機能させる方法はありますか?それが役立つ場合、エラーは次のとおりです。

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
4

2 に答える 2

4

スクリプトの最初でこれを呼び出してみてください。

Add-PSSnapin "VMware.VimAutomation.Core" | Out-Null
于 2012-07-19T18:58:38.147 に答える
1

Powershellホストの外部でPowerCLIコマンドを実行することはできません。

スナップインをPowershellホストに追加するには、次のコマンドTomasを使用します。

Add-PSSnapin VMware.VimAutomation.Core
于 2012-07-21T02:56:27.907 に答える