For a couple of ThinApp packaging machines I didn’t want that the packagers had access to the vCenter Client, but still let them revert to a previous snapshot.

So I wrote a couple of lines to accomplish just that from within the packaging machine itself.

The script below reverts the virtual machine back to the snapshot that was created earlier.

get-viserver $vmname=$env:computername $snapname="PoSH snapshot" $snap=Get-Snapshot -vm (get-vm -name $vmname) -name $snapname set-vm -vm (get-vm -name $vmname) -Snapshot $snap -confirm:$false

Prequisites for this are that PowerShell is installed on the machine as is the PowerCLI. You also need a user account that has just enough permissions in vCenter to connect, do some VM actions like reboot and revert to snapshot.