GeekAfterFive

Infrastructure as Code

home

vCloud 5.1 API Support in PowerCLI 5.1 R2

11 Feb 2013

Quite a few people have been asking about vCloud 5.1 feature support in PowerCLI. Guess what: It's here! PowerCLI 5.1 R2 has officially dropped, and the new vCloud 5.1 features are built in!

You will find all the new 5.1 API properties and methods in the .extensiondata of objects such as a VM returned by Get-CIVM. Snapshots come to mind as a frequent request. Here's how to find them:

$vm=Get-CIVM "MyVM"
$vm.ExtensionData | Get-Member

The .extensiondata property is really the same object as you would get from the Get-CIView cmdlet.

So, lets say we wanted to find out what new fancy 5.1 VM snapshot properties and methods are available to us:

$vm=Get-CIVM "MyVM"
$vm.ExtensionData | Get-Member *snapshot*

PowerCLI snapshots

From this,  we see that we now have the ability to automate the creation, removal and revert of snapshots in vCloud Director 5.1!

Creating, Reporting on, and Removing snapshots is now easy!

# Create Snapshot (Snapshot memory false, quiece true, snapshot name, description)
$vm.extensiondata.CreateSnapshot($false,$true,"Snapshot","Description")
# Get VM snapshot
$vm.ExtensionData.GetSnapshotSection().snapshot
# Remove Snapshots
$vm.ExtensionData.RemoveAllSnapshots()

Let's check out another one. Edge Gateways are new in vCloud Director 5.1. How do we find those without any new cmdlets? Search-Cloud!

Search-Cloud -QueryType EdgeGateway | Get-CIView

Search-Cloud returns a search object, and from this we can get the .NET object with all the properties and methods.

$edge | Get-Member
Edge Gateway in PowerCLI

Note that we don't have to use the .extensiondata, because we used Get-CIView to directly get the .NET object.

Let's check out the .configuration!

$edge.configuration

PowerCLI Edge Gateway Configuration

Both the vCloud Admin and Tenant PowerCLI snap-ins have been updated, so if your cloud provider is running on 5.1, enjoy the new features!

Now, this is certainly not all PowerCLI 5.1 R2 has to offer.  Powershell 3 support as well as an official VDS snap-in are also available! You can read more about these updates on the Official PowerCLI Blog! For tons of VDS examples, See Alan's post!

comments powered by Disqus