# encoding: ascii
# api: powershell
# title: Roll-Dice.ps1
# description: A really bad roll-dice script to do ‘bad things’ to vmware snapshots taken on the pipeline.
# version: 0.1
# author: Cody Bunch
# license: CC0
# x-poshcode-id: 1953
# x-archived: 2013-11-15T09:16:02
# x-published: 2010-07-07T11:28:00
#
#
# Roll-Dice.ps1
# Cody Bunch
# ProfessionalVMware.com
Begin {
$rand = New-Object System.Random
$dice = $rand.next(1,4)
}
Process {
if ( $_ -isnot [VMware.VimAutomation.Types.Snapshot] ) { continue }
if ($dice -gt 1) {
$_ | Remove-Snapshot -Confirm:$false
Write-Host "OH NOES! Snapshot $_ Has been deleted!`n"
} else {
Write-Host "Snapshot $_ lives to fight again!`n"
}
}