Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 246286

Re: Assistance required running PowerCLI cmdlets from vCO

$
0
0

Thanks for the suggestions Ivo, in fact I had an issue  with my script and as you suggested I was able to run it directly on a shell on the powershell host. The script is very simple and its purpose is just to make sure I can run PowerCLI cmdlets against vCenter:

 

Param($server,$username,$password)
Add-PSSnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue

 

Write-Output $server
Write-Output $username
Write-Output $password

Connect-VIServer $server -User $username -Password $password
$vm = Get-VM -Name XXX
$vm.Id
Disconnect-VIServer $server -Confirm:$false

 

When I run the script using the "Invoke an external script" (NOTE: the parameters must be around single quotes) from vCO the workflow hangs and just prints the following message on the logs:

"Invoke command in session 74bf7440-b98e-4271-acc0-a16ea9c57a24"

 

I have to manually cancel it, but after some retries I started getting an error indicating that the number of WinRM sessions was exceeded (I guess the limit is 5), indicating that every workflow was running in limbo even when I manually canceled it. Anyways, I got rid of that error by restarting the powershell host and decided to run the same script but this time using the "Invoke a PowerShell script" and limiting the PowerCLI commands to just connect to VIServer and to no more. Then, I got the following error:

 

Connect-VIServer : 1/23/2013 12:55:18 PM    Connect-VIServer        Exception o
f type 'System.OutOfMemoryException' was thrown.   
At line:2 char:17
+ Connect-VIServer <<<<  -Server 'XXXXX' -User 'XXXXXXX' -Pas
sword 'XXXXXXXX'
    + CategoryInfo          : NotSpecified: (:) [Connect-VIServer], ViError
    + FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_Excep
   tion,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer

(Dynamic Script Module name : invokeScript#14)


Viewing all articles
Browse latest Browse all 246286

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>