VMware Cloud Community
jkeegan
Contributor
Contributor

Issues with vCloud Cmdlets when connecting to a CIServer using SessionID

I'm working on a PowerCLI script that deploys vCloud vApps to multiple OvDCs. The script works great when it's serial, but I have been running into issues when trying to get the deployments to run in parallel. It seems that some of the vCloud cmdlets have issues when connection to a CIserver using the SessionID.

Connecting to a CI server using the SessionID, like so, works fine.

Connect-CIServer -Server $CIServer -SessionID $SessionID

But some cmdlets error out with the message "Object reference not set to an instance of an object.". For example:

PS>Get-OrgVdc
Get-OrgVdc : 10/21/2012 11:01:11 AM    Get-OrgVdc        Object reference not set to an instance of an object.
At line:1 char:11
+ Get-OrgVdc <<<<
    + CategoryInfo          : NotSpecified: (:) [Get-OrgVdc], VimException
    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.Cloud.Commands.Cmdlets.GetOrgVdc

I also get an odd error when trying to deploy the new vApp regarding not being able to get the results of the task.
PS>$Catalog | Get-CIVAppTemplate -Name $vAppTemplateName | New-CIVApp -Name $vAppName
New-CIVApp : 10/21/2012 11:17:46 AM    New-CIVApp        Could not obtain the result of task '/CIServer=username:orgname@ciserver.com:443/CITask=urn:vcloud:
task:8b2a5b94-7fb7-42f9-b99f-b93c9ad43ab3/'. Task name is 'vdcInstantiateVapp'. The following error occured: Object reference not set to an instance of an object.
At line:1 char:67
+ $Catalog | Get-CIVAppTemplate -Name $vAppTemplateName | New-CIVApp <<<<  -Name $vAppName
    + CategoryInfo          : NotSpecified: (:) [New-CIVApp], VimException
    + FullyQualifiedErrorId : CloudImpl_CITaskServiceProvider_ConvertTaskResult_Failed,VMware.VimAutomation.Cloud.Commands.Cmdlets.NewCIVApp

It all works correctly when connecting to the CIserver using the normal credential method (i.e. establishing a new session). For the sessionID I am grabbing it from an existing PowerCLI session ($SessionID = $global:DefaultCIServers[0].SessionID).

Any insight or thoughts would be great.

PowerCLI and vCloud Version  5.1

Thanks!

Joe

0 Kudos
0 Replies