Too many problems, not enough time.

Connecting to vCloud Director via PowerCLI

I’m currently stuck administrating a vCloud Directory 1.5 environment. I don’t have any major concerns with vCD 1.5 but sometimes I do find the web portal a little awkward to navigate around. VMware have done a great job in creating PowerCLI cmdlets that open up access into the vCD APIs.

You can obtain access to the cmdlets via two methods. You can download PowerCLI from VMware. You’ll need at least version 5.0.1. Or you can download PowerCLI for Tenants. This version contains only the vCD cmdlets and removes all the other vSphere cmdlets not relevant to vCD.

If you’re connecting to vCD over the internet the great thing is you don’t need any extra or special ports opened to use PowerCLI. Connection is done over HTTPS (Port 443) using the domain name of your Cloud Service Provider’s vCD portal.

You’ll also need your ORG name within vCD. To find out your ORG name connect up to the vCD web portal. Navigate to the Administration tab and select General under Settings in the left pane.

Open up PowerCLI. Use the cmdlet Connect-CIServer to initiate a connection.

Connect-CIServer -Server portal.vpdc.domain.com -org MYORG

You should then be prompted for your vCD login credentials.

Once connect you you can start playing around with some of the more basic get commands.

To view your usage of CPU, Memory and Storage allocation you can use get-orgvdc.

get-orgvdc | ft -autosize

To list all your VMs it’s just a matter of get-civm

get-civm | ft name, status, cpucount, memorygb -autosize

To list details of a specific VM you can try the follow

get-civm -name MYSERVER | fl

The cmdlets won’t give you the full feature set as the web portal. Never the less you’ll find that you can speed up a lot of the daily administrative tasks you do. It’s also a great way of extracting out information for reporting.