Created
November 15, 2014 09:38
-
-
Save jagland/966ee56defdc1fd3622e to your computer and use it in GitHub Desktop.
VMWare VCB Backup Snapshot Remover
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This a dirty script to remove any VCB Backup snapshosts - see my vm-backup.sh in gist | |
PATH=$PATH:/usr/sbin | |
VCBVMNAME="/usr/sbin/vcbVmName" | |
VCBSNAP="/usr/sbin/vcbSnapshot" | |
VMLIST=$(/usr/sbin/vcbVmName -h vcenter -u username -p password -s powerstate:on | grep moref | awk -F\: '{ print $2 }' | |
for i in $VMLIST; | |
do | |
SNAPNAME=$(/usr/sbin/vcbSnapshot -h vcenter -u username -p password -f moref:$i "_VCB-BACKUP_" | grep "SsId:" | awk -F: '{ print $2 }') | |
if [ $SNAPNAME ] | |
then | |
echo Removing $SNAPNAME Snapshot for $i | |
$VCBSNAP -h $HOST -u $USERNAME -p $PASSWORD -d moref:$i ssid:$SNAPNAME | |
fi | |
SNAPNAME='' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment