Setting the VMUndoAction under Virtual Server

To be honest, I did not know about this attribute until I stumbled across it just the other day. Under Virtual PC, if the guest operating system shuts down and we have undo disks enabled - the user will get prompted as to whether they want to keep, commit or discard the undo disks. Unfortunately with Virtual Server we cannot assume that the user will be present to answer a prompt - so we have to choose a default action. Normally under Virtual Server we will always keep the undo disks - however - you can change this behavior if you want.

Each Virtual Server virtual machine has an attribute called 'UndoAction'. This is normally set to '1' for 'keep', but it can also be set to '0' for 'discard' or '2' for 'commit'.

Below is a simple script that checks and sets a virtual machines UndoAction attribute.

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("The name of the virtual machine")

WScript.Echo "VM Name: " & objVM.Name
WScript.Echo "Undo action: " & objVM.UndoAction

'Set the undo action to discard
objVM.UndoAction = 0

'Confirm that the settings change stuck
WScript.Echo "New Undo action: " & objVM.UndoAction

Cheers,
Ben