Tags

, ,


As a VMware administrator, making the VM snapshots under control is one of the critical tasks.

image

I wrote up a ‘List all VM with snapshot’ workflow which generate a report showing the virtual machines that have snapshots.

The key is in the scriptable task:

vmWithSnapshots = new Array();
var vms = VcPlugin.getAllVirtualMachines();
var logtext;

for(i in vms){
var vm = vms[i];
if(vm.runtime.connectionState.value==”connected” && !vm.config.template){
var actionResult = System.getModule(“com.vmware.library.vc.vm.snapshot”).getAllSnapshotsOfVM(vm);
if(actionResult.length > 0){
vmWithSnapshots.push(vm);
System.log(“VM name : ” + vm.name + ” – Number of snapshots : ” + actionResult.length);
logtext = “VM name : ” + vm.name + ” – Number of snapshots : ” + actionResult.length;
content = content + “<br>” + logtext;
}
}
}
vmsLength=vmWithSnapshots.length;
System.log(vmsLength + ” VM have snapshots”);
subjects = vmsLength + ” VM have snapshots”;

A email will be sent to the requester after the workflow is completed.

image

 

 

************************************************************************************************

TLV, this is FYI:

binding

Advertisements