Article
RSS
CODE: Setting the BIOS boot order programmatically under Virtual Server

Ben Armstrong and John Howard swoop in with another Microsoft Virtual Server code tip!

Do you want to learn how to programmatically change the boot order of a virtual machine's BIOS?  Ben explains this is accomplished by using GetConfigurationValue and SetConfigurationValue, two powerful and useful APIs. 

The following script takes two virtual machines as command line parameters and copies the BIOS configuration from one to the other. 

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

key = "hardware/bios/cmos"

result = vm2.SetConfigurationValue(key, vm1.GetConfigurationValue(key))

Ben notes that the reason he copies between machines rather than loading a preconfigured value is because the CMOS key is actually a byte value and is difficult to manage under VBScript.

Visit Ben's original article to comment.

Published Saturday, April 22, 2006 9:54 AM by David Marshall
Filed under:
Share this post: del.ici.ousDel.ici.ous Digg ThisDigg Newsvine ThisNewsvine Reddit ThisReddit Slashdot It!Slashdot TechnoratiTechnorati
Comments
Richard - (Author's Link) - April 22, 2006 12:32 PM
Microsoft has also said the the BIOS value in the Configuration is opaque data and should not be counted on for future compatability in the future, such as on Viridian.
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