2012-07-19 2 views
2

Connect-VIServer 등의 PowerCLI 명령을 사용하는 powershell 스크립트 파일이 있습니다. PowerVI에 라이브러리 참조를 추가 한 후 PowerGUI에서 스크립트 파일을 실행할 수 있지만 어떻게 작동하는지 모릅니다 SoapUI를 통해 실행합니다. 나는 그것도 일반 Powershell CLI와 함께 작동하지 않을 것 같아요. 이 일을 할 수있는 방법이 있습니까? 여기에 도움이된다면 오류는 다음과 같습니다SoapUI를 사용하여 VMWare powerCLI 명령 실행

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 
+0

나는 정상적인 윈도우 명령 프롬프트에서 내가 스크립트를 실행할 수 있는지 나는이 작업을 수행 할 수 있습니다 실현 :

는 토마스가 언급 한 명령을 사용 파워 쉘 호스트에 스냅인을 추가합니다. SoapUI의 Groovy 스크립트에서 "powershell Test.ps1"명령을 실행합니다. "powercli Test.ps1"과 같은 것을 사용하면 저에게 도움이 될 수 있습니다. 불행히도 그것은 작동하지 않습니다. 그런 마법 명령이 있습니까? – dhishkaow

답변

4

시도는 스크립트의 시작이 전화 :

Add-PSSnapin "VMware.VimAutomation.Core" | Out-Null
+0

soapUI의 Groovy 스크립트에 추가 된 내용으로 오류가 있습니다. org.codehaus.groovy.control.MultipleCompilationErrorsException : 시작 실패 : Script2.groovy : 1 : EOF가 필요합니다. 'VMware.VimAutomation.Core'가 발견되었습니다. – dhishkaow

+0

또한 추가를 시도했습니다. 그것은 Powershell 스크립트에 그 스크립트가 Groovy를위한 것이 아니라는 것을 알게 된 후 : D. 도움을받지 못했습니다 :( – dhishkaow

1

당신은 PowerCLI는 파워 쉘 호스트의 외부 명령을 실행할 수 없습니다.

Add-PSSnapin VMware.VimAutomation.Core 
관련 문제