-- Ben Armstrong, Hyper-V Program Manager
Talking about Virtual PC and Hyper-V at Microsoft
Well it is time for Ben’s Friday walk down memory lane. Diablo was one heck of a game – and stole a heck of a lot of my time. At the time of its release there were a lot of ‘hard core’ role players who complained about the fact that Diablo wasn’t a true role playing game. But there were those of us who were able to see it for what it was – a bigger, grander, more aesthetically pleasing version of Rogue (http://blogs.msdn.com/virtual_pc_guy/archive/2005/01/07/348770.aspx). Diablo runs acceptably under Virtual PC – though there is a pop in the sound track every now and then:
I have completed Diablo once (as a Warrior) and always intended to go back and complete as the Rogue and Sorcerer characters – but never got around to it… Maybe that can be my project for the weekend :-)
Cheers,Ben
If you want to perform any significant amount of virtual machine automation with Virtual Server – you will need to figure out how to drive the keyboard. There are a number of possible methods for doing this – and each one has its advantages:
VM.keyboard.TypeASCIItext
This method is handy for typing large strings of ASCII text. Its advantages are that it provides an easy method to input large strings of text. It is also handy because one of the problems that you can encounter while automating keyboard input is that it is easy to ‘type too fast’ for the guest operating system to keep up with – and this method makes sure that the text gets typed at just the right speed. An example of using this method would be:
VM.keyboard.TypeASCIItext “Hello World!”
VM.keyboard.TypeKeySequence
While this method is more complicated than ‘TypeASCIItext’ it does provide an easy way to automate complex key combinations. It requires you to specify key down and key up events in the order that you want them to happen. A common usage of this method is to type CTRL+ALT+DEL on a virtual machine – as follows:
VM.keyboard.TypeKeySequence "DOWN,Key_LeftCtrl, DOWN,Key_LeftAlt, DOWN,Key_Delete, UP,Key_LeftCtrl, UP,Key_LeftAlt, UP,Key_Delete"
VM.keyboard.PressAndReleaseKey
This method provides the easiest way to send through a single key down and key up event for a given key. This is most useful for situations where you need to hit Enter or Tab to navigate a user interface. For example:
VM.keyboard.PressAndReleaseKey "Key_Enter"
One final point to make is that the key codes used for Virtual Server can be found in the Virtual Server Programmers guide in the ‘Key Identifiers Reference’ section.
A while ago I posted about using Virtual PC in order to run Dark Forces under Windows XP (http://blogs.msdn.com/virtual_pc_guy/archive/2004/11/27/270927.aspx) – which got me to wondering whether its much more successful sequel ‘Jedi Knight: Dark Forces II’ would run under Virtual PC too – and it does:
In order for it to be playable you need to disable the mouse integration functionality under Virtual PC (http://blogs.msdn.com/virtual_pc_guy/archive/2005/03/14/395625.aspx) but otherwise it runs great. I have no idea why you would want to do this though :-) (apart from the ‘coolness’ factor).
If you are using the Virtual Server 2005 SP1 Beta (details here: http://blogs.technet.com/megand/archive/2005/04/20/403950.aspx) one of the new additions is a F6 driver floppy. This is located under the Virtual Server installation directory “Virtual Machine Additions” and is called “SCSI Shunt Driver.vfd”. You can use this floppy during the early stages of Windows installation (when you are prompted to hit ‘F6’ to load any custom drivers) to install Windows using our optimized SCSI driver as opposed to the generic Adaptec driver.
For most users this will make a small difference in install times (approximately 10%) – but for some users it will make a significant difference.
Some users have reported that Windows installation under Virtual Server while using the emulated SCSI controller can take up to 6 to 24 hours. These users are usually running physical systems that have physical SCSI hard disks in them as well. The problem is that it appears that these physical SCSI disks have very poor performance for small read and write commands (but excellent performance for large read and write commands). By default the generic Adaptec driver used inside of Virtual Server heavily utilizes small reads and writes. For users who have seen this problem – using the F6 driver floppy should bring operating system install times back down to approximately 1 hour.Cheers,Ben
A number of users have reported problems using the 'net use' command under Windows 98 under Virtual PC. This appears to be a bad interaction between Windows file sharing and the Virtual Machine Additions folder sharing client. There are two easy ways to work around this problem:
One of the biggest challenges with automating virtual machines today is being able to detect that a virtual machine is at a specific place in execution (like waiting at the Windows login screen). A highly effective way to do this is to do a comparison on the thumbnail image of the virtual machine. While this is only a 64x48 pixel image it is highly accurate for automation purposes. Here is a piece of script that will save the thumbnail of a virtual machine to a text file. Usually the thumbnail data is returned as an array - for convenient storage and comparison the Join() command can be used to turn the thumbnail into a string:
'This script takes three parameters. The Virtual Server Host, the virtual machine name and'the file name to store the thumbnail data in. It then saves the current thumbnail data for'the selected virtual machine to the specified data file vsHost = WScript.Arguments(0)vmName = WScript.Arguments(1)thumbnailFile = WScript.Arguments(2) 'Connect to Virtual ServerSet vs = CreateObject("VirtualServer.Application", vsHost) 'Find virtual machineset vm = vs.FindVirtualMachine(vmName) Wscript.echo "Saving thumbnail data" 'Save thumbnail dataSet objFSO = CreateObject("scripting.filesystemobject")Set objTextStream = objFSO.OpenTextFile(thumbnailFile, 2, True)objTextStream.WriteLine Join(vm.Display.Thumbnail) objTextStream.close
'This script takes three parameters. The Virtual Server Host, the virtual machine name and'the file name to store the thumbnail data in. It then saves the current thumbnail data for'the selected virtual machine to the specified data file
vsHost = WScript.Arguments(0)vmName = WScript.Arguments(1)thumbnailFile = WScript.Arguments(2)
'Connect to Virtual ServerSet vs = CreateObject("VirtualServer.Application", vsHost)
'Find virtual machineset vm = vs.FindVirtualMachine(vmName)
Wscript.echo "Saving thumbnail data"
'Save thumbnail dataSet objFSO = CreateObject("scripting.filesystemobject")Set objTextStream = objFSO.OpenTextFile(thumbnailFile, 2, True)objTextStream.WriteLine Join(vm.Display.Thumbnail) objTextStream.close
While this script function will load a thumbnail and wait for a match:
'Function to check the for a thumbnail matchFunction checkForThumbnailMatch(thumbnailFile) checkForThumbnailMatch = false 'Open requested thumbnail fileSet objFSO = CreateObject("scripting.filesystemobject")Set objTextStream = objFSO.OpenTextFile(thumbnailFile, 1, True)savedThumbnail = objTextStream.ReadLineobjTextStream.close 'Poll for matching thumbnail do until savedThumbnail = Join(vm.Display.Thumbnail) wscript.sleep(2000) loop checkForThumbnailMatch = true end Function
'Function to check the for a thumbnail matchFunction checkForThumbnailMatch(thumbnailFile)
checkForThumbnailMatch = false
'Open requested thumbnail fileSet objFSO = CreateObject("scripting.filesystemobject")Set objTextStream = objFSO.OpenTextFile(thumbnailFile, 1, True)savedThumbnail = objTextStream.ReadLineobjTextStream.close
'Poll for matching thumbnail do until savedThumbnail = Join(vm.Display.Thumbnail) wscript.sleep(2000) loop
checkForThumbnailMatch = true
end Function
This is very handy - and we have been able to use this internally to automate a variety of things - like complete operating system installations.
And now we know one of the reasons why Ben is in 'Vegas. This years Microsoft Management Summit saw the arrival of some significant announcements around Microsoft's plans for virtualization. To summarize:
In the short term, Microsoft is responding to customers' needs by improving the performance and interoperability of Virtual Server 2005 and improving manageability through integration with Microsoft® Operations Manager (MOM) 2005:
In addition to these near-term product deliverables, Microsoft is working with the industry and increasing its investments to provide customers with more robust virtualization and virtualization management solutions for the Windows® platform:
A full press release can be found here: http://www.microsoft.com/presspass/press/2005/apr05/04-20VirtualizationInvestmentsPR.asp
(Who will be partying tonight! :-)
One of the biggest complaints that we have heard from customers is that the support policy for Virtual Server was not very clear. The main cause of this lack of clarity has been that it has been up to each Windows Server System team to decide and communicate their own support policy. However - thanks to the fantastic work of one of my fellow PM's on the Virtual Machine team (here's to you Jeff!) - we now have a unified support policy that outlines what is and isn't supported by Microsoft inside of Virtual Server:
KB: 897613 Microsoft Virtual Server support policyhttp://www.support.microsoft.com/kb/897613
KB: 897614 Windows Server System software not supported within a Microsoft Virtual Server environmenthttp://www.support.microsoft.com/kb/897614
Well we have come to the final entry in the 'SimCity' series. You might be surprised to know the SimCity 4 runs under Virtual PC - I know I was. Despite the fact that SimCity 4 states that it has a minimum requirement of a DirectX 7.1 3D capable card with 32mb VRAM - it runs perfectly fine inside of Virtual PC on our lowly S3 Trio with 8mb VRAM. Go figure.
Continuing with the usual approach - SimCity 4 takes the standard SimCity formula and makes it even more detailed and more complex. Too be honest I find it to be a bit too complex - as at the end of the day it has an enormously steep learning curve. But the graphics sure are pretty:
All in all I would have to say that I am hard pushed to decide which version of SimCity I like the most. They all have their pro's and con's - and they will all steal hours of your life if you let them :-)