GeekAfterFive

Infrastructure as Code

home

vCloud Director Snapshots with PowerCLI

02 Oct 2012

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 yet. (I stress "yet." :D) 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:
Import-Module vCloudSnapshots.psm1
After that, you'll have access to 4 cmdlets:
Get-CISnapshot
New-CISnapshot
Remove-CISnapshot
Set-CISnapshot
To get snapshots:
# Get vApps with Snapshots
Get-CIVapp | Get-CISnapshot

# Get VMs with Snapshots
Get-CIVM | Get-CISnapshot

# Get Snapshot info for a particular VM
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:
# Create a snapshot for a vApp (or all VMs in the vApp, really.)
Get-CIVApp "MyVApp" | New-CISnapshot

# Revert to our snapshot
Get-CIVApp "MyVApp" | Set-CISnapshot -revertToCurrent

# Remove our snapshot
Get-CIVApp "MyVApp" | Remove-CISnapshot
For more help, just use Get-Help and the command! vCloud Snapshots Powershell Module
comments powered by Disqus