Roll-Dice – PowerCLI & Fun with VMware Snapshots

This post actually has it’s roots in a practical and useful change in VMware’s “delete all” snapshot functionality. For the details, I strongly suggest you go off to Duncan’s page and read all about it. It was that post that in turn generated quite a lot of twitter buzz around some additional features, or naming changes that VMware can improve in the area of snapshots. One of these features was an “I’m Feeling Lucky” button. Well, “I’m Feeling Lucky” doesn’t quite fit the verb-noun format of PowerCLI functions, so I give you instead “Roll-Dice.ps1”:

Roll-Dice – The Script

Roll-Dice – The Results

localhost-20100707-130735[1]

And to stage the snapshots… well, that was also PowerCLI:

$i = 1; while ($i -lt $rand.next(6,16)){ get-vm -name "Home*" | new-snapshot -name $i -Confirm:$false; $i++ }