Virtualization Technology News and Information
Article
RSS
CODE: Using Set and Get ConfigurationValue with Virtual Server

Ben Armstrong shows you how to use GetConfigurationValue and SetConfigurationValue to change any value in the virtual machine configuration file.  Ben claims "this can be very useful for getting access to some of the more esoteric features of Virtual Server for which a direct COM interface does not exist".  The following script example uses APIs to check and set the mouse integration setting for a virtual machine. 

Set vs = CreateObject("VirtualServer.Application")
set vm1 = vs.FindVirtualMachine(WScript.Arguments(0))

key = "integration/microsoft/mouse/allow"
currentValue = vm1.GetConfigurationValue(key)

Wscript.echo "The state of mouse integration on " & WScript.Arguments(0) & " is: " & currentValue

if currentValue then
 newvalue = false
Else
 newvalue = true
End if

result = vm1.SetConfigurationValue(key, cbool(newvalue))

Wscript.echo "The state of mouse integration on " & WScript.Arguments(0) & " has been set to: " & newvalue

This script takes the virtual machine name as a commond line parameter then gets the current value for the mouse integration setting and informs the user of the current value.  It then changes the configuration value to be the opposite of what it used to be and then informs the user of the change.

Check out Ben's original post and leave him a comment, here.

Published Saturday, April 29, 2006 4:59 PM by David Marshall
Filed under:
Comments
There are no comments for this post.
To post a comment, you must be a registered user. Registration is free and easy! Sign up now!
Calendar
<April 2006>
SuMoTuWeThFrSa
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456