private IMachine CreateVm() { IMachine vm = null; IStorageController hddController; try { Console.WriteLine("[SYSREG] creating VM"); // For allowed OS type values, query IVirtualBox.GuestOSTypes and look for "id" field vm = vBox.CreateMachine(Path.Combine(vmBaseFolder, machineName + ".vbox"), machineName, null, "Windows2003", ""); hddController = vm.AddStorageController("sata0", StorageBus.StorageBus_SATA); hddController.PortCount = 2; vm.MemorySize = 256; // In MB vm.VRAMSize = 16; // In MB vm.SaveSettings(); Console.WriteLine("[SYSREG] registering VM"); vBox.RegisterMachine(vm); } catch (Exception exc) { // Creation failed. Console.WriteLine("Creating the VM failed: " + exc); } return(vm); }