Bluelock Blog

vCloud Director Snapshots with PowerCLI

October 12, 2012 by Jake Robinson

If you or your provider are already running vCloud Director 5.1, you now have access to take a single snapshot of your VMs.

If you want to play with snapshots in PowerCLI, you’re going to need the module in this blog. PowerCLI 5.1 currently only supports the vCloud API 1.5, which means there are no 5.1 API capabilities just yet.

The module uses the current PowerCLI for it’s session and API access, and then bolts on some 5.1 API snapshot magic.

To use the module, simply download the .psm1 file and:

1 Import-Module vCloudSnapshots.psm1

After that, you’ll have access to 4 cmdlets:

1 Get-CISnapshot
2 New-CISnapshot
3 Remove-CISnapshot
4 Set-CISnapshot

To get snapshots:

1 # Get vApps with Snapshots
2 Get-CIVapp | Get-CISnapshot
3  
4 # Get VMs with Snapshots
5 Get-CIVM | Get-CISnapshot
6  
7 # Get Snapshot info for a particular VM
8 Get-CIVM "MyVM" | GetCISnapshot

It should be noted that all the cmdlets apply to a VM or vApp, so always make sure you’re doing a Get-CIVM or Get-CIVapp first.

For example…here’s creating, reverting, and removing:

1 # Create a snapshot for a vApp (or all VMs in the vApp, really.)
2 Get-CIVApp "MyVApp" | New-CISnapshot
3  
4 # Revert to our snapshot
5 Get-CIVApp "MyVApp" | Set-CISnapshot -revertToCurrent
6  
7 # Remove our snapshot
8 Get-CIVApp "MyVApp" | Remove-CISnapshot

For more help, just use Get-Help and the command!

vCloud Snapshots Powershell Module

This blog post was originally posted on GeekAfterFive.com.

Comments for vCloud Director Snapshots with PowerCLI

blog comments powered by Disqus