Tech: Configure unattended operations at virtual machines shutdown in Virtual Server 2005

Ben Armstrong posted another very good technical tip about default action to perform at virtual machines shutdown event in Microsoft Virtual Server 2005:


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

Be sure to read the original post for updates and commets.