I created a basic script for creating snapshots. I honestly spent much more time on the reporting aspect of the script on how it reports the completions of the vms snaps. Same goes for deleting of the snaps..too much time spent on the reporting aspec.
now my issue, my script just runs in a loop based off a file with VM names. the amount of vms I have to snap makes it impossible to do it this way because of my limited window to create the snaps, My script basically does one at a time, once one finishes it works on the next one.
Is there a way to parallelize it a bit to run more than one snap at a time?
As I mention the actual vm snap part is just basic as seen here... maybe I should spend more time on the meat and potatoes of the scrpt than the fancy smancy reporting to go with this script...:)
foreach ($vm in $vmlist)
New-Snapshot -VM $vm -Name "snapshot-name-here" -Memory:$true -Confirm:$false
Has anyone thought about this before? maybe running 2 or 3 snaps at a time.. I dont want to run too many at one time but if I could do 2 or 3 at a time that would greatly reduce the overall time needed.
Have a look at using the -RunAsync parameter to New-Snapshot. When using this parameter, "the command returns immediately without waiting for the task to complete".
Then, it is just a matter of handling some throttling of the snapshot tasks (or let vCenter handle that throttling). That help?