VHD Spec Available for Download

19. October 2006 12:24 by Jaguilar in General  //  Tags:   //   Comments (0)

The VHD format specification is now available for download. The specification contains all the technical details for reading/writing and modifying VHD images. This has a lot of potential, and can be used for things like backup, antivirus scans, image management, disk conversion, and others. The spec was released under Microsoft’s Open Specification Promise:

As of Tuesday, October 17th 2006, Microsoft is providing access to the VHD Image Format Specification Document as a part of the Open Specification Promise (OSP). The OSP provides broad use of Microsoft patented technology necessary to implement a list of covered specifications. The goal of the OSP is to provide our customers and partners with additional options for implementing interoperable solutions. Please reference the OSP Website for complete details.

Link to the Press Release: Microsoft Enhances Interoperability With Open Virtualization Format
Link to download page: Virtual Hard Disk Image Format Specification

Using vhdmount.exe under Windows 2003 Server R2

15. October 2006 11:18 by Jaguilar in General  //  Tags:   //   Comments (0)

When you try to mount a VHD using the vhdmount tool, you may get this error message:

C:\VMs>vhdmount.exe /m DISK.vhd

The VHD file is successfully plugged in as a virtual disk device. However, VHD mount was unable to mount all volumes on the disk. Use Disk Manager to mount the volumes.

The issue is that the drivers are not signed for WHQL, so you need to follow the same steps as detailed in this blog post to make it work (as in Windows XP). Another option, however, is to set the WHQL signing option is to Ignore. This can be done through Control Panel->System->Hardware->Driver Signing:


Once you do this, you’ll be able to mount VHD files without any further errors.

Virtual PC 2007 Beta is out

11. October 2006 09:34 by Jaguilar in General  //  Tags:   //   Comments (0)

Virtual PC 2007 Beta is now available for download from http://connect.microsoft.com. As with other beta software, you need to register for the beta first.

This is a long overdue upgrade that finally supports hardware virtualization. It includes:

  • Hardware-assisted virtualization (both AMD and Intel)
  • Support for Vista both as host and guest OS
  • Support for 64–bit Hosts
  • Bug Fixes and Performance Enhacements

Sysprep on Windows XP

26. September 2006 12:31 by Jaguilar in General  //  Tags: ,   //   Comments (0)

A while back I documented the process for doing a Sysprep on a Windows 2003 installation. Well, that same process works for a Windows XP installation. The sysprep GUI on Windows XP is slightly different, but you only need to make sure that the “MiniSetup” and “Pre-Activate” options are selected before pressing the Reseal button and shutting down the machine.

Here are the instructions to run Sysprep on Windows 2003.

Excellent tip... Mounting a .VHD by double clicking on it

4. September 2006 04:29 by Jaguilar in General  //  Tags:   //   Comments (0)

Last Friday on the Virtual PC Guy's WebLog,  Ben Armstrong, Virtual Machine program manager at Microsoft, posted a registry code snippet to mount vhd files by double clicking on them, and dismount them by using the right-click menu. You can get the code from here. I also recommend that you check out VPC guy’s blog every once in a while – his posts are always useful and interesting.

Volume Shadow Copy Service and Virtual Server ... what's in it for me?

31. August 2006 12:01 by Jaguilar in General  //  Tags:   //   Comments (0)

One of the features available in the latest Beta of Virtual Server 2005 R2 SP1 is the support for the Volume Shadow Copy Service (VSS). VSS is a feature of Windows 2003 server that takes “snaphots” of files, and allows you to quickly create a backup copy of a volume.

For an application to support VSS, it needs to get to a consistent state, freeze, and the perform the shadow copy. Once the shadow copy is created, the application thaws and resumes operations. If an application does not have a VSS provider, VSS cannot guarantee that the resulting shadow copy will be consistent. That is one of the best features of this technology – the actual applications (called “Writers” in VSS-speak) are involved in the creation of the shadow copy, so they can verify that whatever goes into the copy can be later restored without any problems.

By supporting VSS, backup programs (“Requestors”) can now tell Virtual Server that a backup is going to take place. Virtual Server can then make sure that the Virtual Machines are in a consistent state (I”m not sure if it suspends the VMs – I’m currently in the process of finding out that information), and tell the requestor that it is ready for the copy. According to the documentation, creating a shadow copy is very fast – for large volumes I’ve heard numbers of around 30 seconds to 4 minutes. This can also work for quickly cloning a Virtual Server host to another server, so that VMs can resume operations very quickly even if the system goes down.

Virtual Server 2005 R2 SP1 BETA2 is out

30. August 2006 22:00 by Jaguilar in General  //  Tags:   //   Comments (0)

You can now download Virtual Server 2005 R2 SP1 BETA2 from http://connect.microsoft.com. As with other beta software, you need to register for the beta first.

This release is pretty significant because it is the first version to support both AMD-V and Intel-VT hardware virtualization. From the release notes, it includes:

  • AMD Virtualization (AMD-V) compatibility
  • Intel Virtualization Technology (IVT) compatibility
  • Volume Shadow Copy Service support
  • Offline VHD mounting
  • Active Directory integration using service connection points
  • Host Clustering technical white paper

The best part is that you can upgrade existing installations very easily:


I just upgraded my 32–bit workstation, and everything is working like a charm.

Documentation on Best practices for Virtual Server

29. August 2006 11:48 by Jaguilar in General  //  Tags:   //   Comments (0)

When you make a Virtual Server deployment, make sure that you follow Microsoft’s recommended Best practices for Virtual Server. They can improve the performance of Virtual Server installations, and make your life as a system administrator easier.

One important thing that many people overlook when creating multiple VMs is the importance of using Sysprep. I wrote a quick walkthrough here, and you can find documentation on Microsoft’s website about it as well. Sysprep makes sure that each cloned virtual machine will be unique – not using it may introduce security and performance issues in your network.

Reading Virtual Server's performance counters from .NET

29. August 2006 01:55 by Jaguilar in General  //  Tags:   //   Comments (0)

This code allows you to retrieve the information for Virtual Server’s performance counters from C#. It reads both the Virtual Machines and Virtual Processors counters.


   1:  PerformanceCounterCategory vmCat =
new PerformanceCounterCategory("Virtual Machines");
   2:              PerformanceCounterCategory vpCat = 
new PerformanceCounterCategory("Virtual Processors");
   3:  string[] vmInstances = vmCat.GetInstanceNames();
   4:  string[] vpInstances = vpCat.GetInstanceNames();
   6:  List<PerformanceCounter> countersList = 
new List<PerformanceCounter>();
   8:  foreach (string instance in vmInstances){
   9:  PerformanceCounter[] counters =
  10:  foreach (PerformanceCounter pc in counters)
  11:  {
  12:              countersList.Add(pc);
  13:  }
  15:  foreach (string instance in vpInstances)
  16:  {
  17:              PerformanceCounter[] counters =
  18:              foreach (PerformanceCounter pc in counters)
  19:              {
  20:                          countersList.Add(pc);
  21:              }
  22:  }
  24:  while (true)
  25:  {
  26:              System.Threading.Thread.Sleep(1000);
  27:              foreach (PerformanceCounter pc in countersList)
  28:              {
  29:                          Console.WriteLine(
                                  "{0}:\"{1}\" Counter:{2} Value:{3}",
                                  pc.CategoryName, pc.InstanceName,
                                  pc.CounterName, pc.NextValue());
  30:              }
  31:  }

Differences bewteen Virtual Server and the Hypervisor

25. August 2006 04:03 by Csaborio in General  //  Tags:   //   Comments (0)
When working with these labs, people who have heard about the hypervisor integration
usually ask what is going to be different between the hypervisor and the current offerings or Virtual Server 2005 R2 Beta. In this link, you an find extensive information about the difference between them, but of special interest is the table below:

Virtual Server 2005 R2
Windows Server Virtualization
32-bit VMs
64-bit VMs
Multi-processor VMs?
Yes, up to 8 processor VMs
VM memory support?
3.6 GB per VM
More than 32 GB per VM
Hot add memory/processors?
Hot add storage/networking?
Can be managed by System Center Virtual Machine Manager?
Cluster support?
Yes, using COM
Yes, using WMI
Number of running VMs?
More than 64. As many as hardware will allow.
User interface
Web Interface
MMC 3.0 Interface

This table only goes to show that Microsoft’s Virtualization strategy in the future will offer a lot more than Virtual Server. Keep in mind that these features will be available about 180 days after Windows Longhorn Server ships, so until then, we will just have to sit back and watch these long awaited features with a lot of patience.

Paravirtualization and Xen

25. August 2006 03:57 by Jaguilar in General  //  Tags:   //   Comments (0)

Another virtual machine product that has been making a lot of noise lately is Xen, the open source project from Xensource. Xen uses a different  approach to virtualization than Virtual Server, called Paravirtualization. In this type of virtualization, the guest OS has to be modified to work with a software interface to the Virtual Machine Monitor, instead of thinking it is running on the hardware. The thing is that this actually enables better performance of the Guest OS, as it aware that is running on a virtual machine environment. Xen also supports running unmodified OSes, but for that it is mandatory to have hardware virtualization (VT-x on Intel or SVM on AMD CPUs).

The next releases of Windows Virtualization are implementing a similar approach. It will still be pure virtualization, but the Guest OS will also be enlightened. What this means is that the Guest OS will be aware that it is running on a VM, so it will be able to increase the performance using a modified kernel. The best part about all this is that Microsoft and Xensource are actually working together to make sure that the technology included with Windows Virtualization will be compatible with the technology used in Xen. So, at the end, we, the customers, win.

Who says you can't expand VHDS?

17. August 2006 12:36 by Csaborio in General  //  Tags:   //   Comments (0)
It is a well known fact that dynamic VHDs that reach their limit cannot be made any bigger when running in Virtual Server.  I recently stumbled onto this problem when creating a differentiating disk from a base install of a dynamic disk of Win2K3 with 2 GB tops space.  I had two choices at this point:

  1. Create a new VHD and install everything I had done
  2. Try to find a way to expand the VHD with whatever hack came to my mind.
Being the stubborn person that I am, I decided to follow the latter.

The good news is that i t can be done - the bad news is that it may be a bit of an overkill!  Anyhow, here is what you need:

  1. A BartPE ISO that has some kind of imaging utility (ours has Ghost and TrueImage - amazing programs!)
  2. A fixed empty VHD that will fit the image of the disk you are trying to expand
  3. Lots of patience
Step 1: Image the Image

  1. Add the BartPE.iso as an additional CD-ROM Drive
  2. Add the empty VHD (let's call it images.vhd) as an additional VHD
  3. Boot your PC, it should boot from the CD and Bart-PE should start
  4. Format images.vhd into an NTFS drive using whatever you want
  5. Create an image of your source disk (the one you are trying to expand) and place it on the images drive
Step 2: Restore the Image

  1. Create a new VM configuration with a new VHD that will hold the new size (format it as NTFS with any utility you like)
  2. Add the BartPE.iso as an additional CD-ROM Drive
  3. Add the images VHD as an additional VHD
  4. Boot your PC, it should boot from the CD and Bart-PE should start
  5. Use Ghost or whatever you want to restore from the Image from the Images.vhd
Reboot.  Enjoy!

Virtualization 101 for IT

11. August 2006 08:09 by Csaborio in General  //  Tags:   //   Comments (0)
Without a doubt, Virtualization is the tech buzz word for this year.  Every newsletter I receive has a link to at least 3 VT sites.  Recently I stumbled on this entry which is a podcast by Dean Wells, who does a great job explaining what IT should consider nowadays when making computer purchases. 

I think many IT departments are blindly making purchases of hardware that do not support VT technology.  What they don't know is that the moment they purchase this new equipment, they are pretty much buying outdated equipment.  Mr. Wells does an amazing job explaining what IT departments should strive for when making these types of decisions, it is definitely worth a listen.

Copy and Paste from Host VM to Guest VM (and vice-versa)

11. August 2006 06:08 by Csaborio in General  //  Tags:   //   Comments (0)
I have to admit I was a bit shocked when I tried to copy and paste text between VMs using Virtual Server.  The clipboard was not copied at all and there was no easy way to transfer text back and forth.  I tried installing the Virtual PC Additions and still no luck.  I could not believe they left out a feature like this one out - I don't know if enabling this is trivial using some super secret setting, but until then, here is a workaround.

It is actually quite simple, and it was Stephen who hinted me on this while I was ranting.  On the host machine, enable Remote Desktop Connections and connect using a RDC client.  You will be connecting to the VM just like any other mahine, and RDC supports copying and pasting of text back and forth.

Not the best solution, I know, but it gets the job done.  It is also worth noting that the same problem happens with VMWare's VM player.

Virtual Server, WMI and C#

11. August 2006 00:18 by Jaguilar in General  //  Tags:   //   Comments (0)

This code snippet allows you to connect to a remote instance of Virtual Server 2005 R2, via WMI, and retrieve all the Virtual Machine WMI objects.

   2:  System.Management.ConnectionOptions co = 
   3:      new System.Management.ConnectionOptions();
   4:  co.Username = user;
   5:  co.Password = password;
   7:  ManagementScope scope = new ManagementScope(
   8:      new ManagementPath(@"\\"+computer+
  10:  scope.Connect();
  11:  SelectQuery oq = 
  12:      new SelectQuery("SELECT * FROM VirtualMachine");
  14:  ManagementObjectSearcher searcher =
  15:      new ManagementObjectSearcher(scope, oq);
  17:  foreach (ManagementObject queryObj in searcher.Get())
  18:  {
  19:       //Do something
  20:  }

You need to provide a user and password with enough credentials to query the Virtual Server instance.
BTW, if you ever need to format your code for display on the web, check out this website.

Yes!! Virtual Machine Manager (aka Carmine) available for download

7. August 2006 12:15 by Jaguilar in General  //  Tags:   //   Comments (0)

Carmine” (System Center Virtual Machine Manager (SCVMM) Beta 1) is available for download! You first need to register for the beta at http://connect.microsoft.com, and then login into http://connect.microsoft.com/vmm/downloads with your passport Id.

I just finished downloading it and will start playing with it soon. Too bad that calling into VMM from Powershell and the functionality to convert from a physical machine to a virtual machine are not included in this beta.

.NET and the Virtual Server 2005 COM API

3. August 2006 09:00 by Jaguilar in General  //  Tags:   //   Comments (0)

Accessing Virtual Server’s COM objects from .NET is not as direct as just including the references to the COM classes. In order to instantiate to the Virtual Server object, you need to have the proper COM permissions. For Virtual Server, the required impersonation level must be Impersonation or higher.

There are two ways to achieve this:

  1. The first one is to use Component Services to change the Default Impersonation Level to Impersonate. To do this in the Component Service console, go to Computers->My Computer->Properties, and the setting is in the Default Properties tab. This has obvious security implications, though.
  2. The second method is to do it programatically. This can be a bit painful if you’re not familiar with COM and COM Security. You have basically two options:
    • Use the method described in the Virtual Server Programming Guide, that you can find here: .
    • You can also use an alternative method, described by Virtual PC Guy in his blog as a solution to connect to Virtual Server from Powershell. You can check the link to review the code, which consists in using the CoSetProxyBlanket function, that according to the documentation “Sets the authentication information that will be used to make calls on the specified proxy.” Implementing a class similar to the one described on the linked page should work and is much simpler than the recommended approach descrbied in the Programming Guide.

Virtual Server Script Center repository

2. August 2006 10:01 by Jaguilar in General  //  Tags:   //   Comments (0)

Scripting allows you to automate common tasks very easily, even if you’re not an experienced developer. One of the best resources for scripters in the Windows world is definitely MSDN Technet’s Script Center. If you’re looking for common scripts, chances are you’ll find one there, or one that you can quickly modify to suit your needs. There’s a large selection of scripts that have to do with Virtual Server – from automatically installing Virtual Machine additions, to modifying the properties of a Virtual Machine. You can check out the complete list here: Virtual Machine and Virtual Server Properties

Running scripts on a remote Virtual Server installation

2. August 2006 09:46 by Jaguilar in General  //  Tags:   //   Comments (0)

If you need to connect to a Virtual Server 2005 installation to execute remote scripts, because of security, you can do one of two things. The first one is to use the “ConnectServer” method in your scripts, in order to provide the necessary credentials to connect to the server. To do this, you should have these lines on your script:

Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objwbemLocator.ConnectServer(<Computer>, "\\root\vm\virtualserver", <user>, <password>)

Then you can use the normal methods to query the information from Virtual Server

The second one is to configure the Virtual Server DCOM object so that it allows a remote connection. This has obvious security risks, but can be configured so that only certain groups have the necessary priviledges to execute the code. To do this, you first need to open the Component Services console, and navigate to the node Console Root->Component Services->Computer->My Computer->DCOM Config. There, you need to locate the Virtual Server node, and select properties from the context menu:


On the properties page, go to the Security tab, and you need to customize the permission on the Launch and Activation Permissions box by clicking Edit…:


On that page, you can add groups or users that will be able to launch or activate Virtual Server’s COM objects, as well as fine-tune what each user will be able to do:


This second approach works better with servers that are in an Active Directory domain. On a stand-alone machine, the remote host may have issues providing the credentials to obtain the remote activation and launch permissions required.

WMI and Virtual Server 2005

28. July 2006 09:50 by Jaguilar in General  //  Tags:   //   Comments (0)

WMI (Windows Management Instrumentation) provides a mechanism to manage systems and applications in an enterprise environment. WMI is actually Microsoft’s implementation of Web Based Enterprise Management (WBEM), a unified mechanism used for managing networks.

With the release of Virtual Server 2005, Microsoft included new classes in WMI in order to manage and monitor VS2005 installations. These classes are represented through a namespace, in this case //root/vm/virtualserver. So, if you are new to WMI and Virtual Server, what can you do with this information?
Let’s start off by introducing you to two tools that can get you started.

The first one is WMI Explorer, a free tool from KS-Soft, that can show you the available classes and methods in a WMI namespace. When you first start up the application, you’ll see a class explorer that shows you all the classes available in the default namespace, root\cimv2 (CIM stands for Common Information Model, the data model of the WBEM standard). To connect to a different namespace, you need to select Action->Connect to Remote Host… , and then enter Virtual Server’s namespace:


You can also enter the address of a remote host to connect to a remote instace of Virtual Server. Keep in mind that you need to enter a user with enough privileges.
Once you press enter, you’ll be presented with Virtual Server’s classes. Of particular interest are the last four: VirtualMachine, VirtualNetwork, VirtualServerProvider and VmWmiObject:


With these four classes you can access virtually all information about a Virtual Server installation. Double clicking on them in WMI Explorer will show you all of its properties and the current state.
With this information, what things can you do? Well, that’s where the second tool comes into play. It is called Scriptomatic 2.0,  a WMI utility you can download from Microsoft’s website that helps you write WMI scripts. When you open this tool, you first need to select the correct WMI namespace:


And after that, you can select any of the WMI classes declared within that namespace, and that will write a basic script for you that queries the class:


Based on it, you can start querying the VMs, the Virtual Networks, the status of the server, etc… and you can even run the scripts from within Scriptomatic. From this point on, you can start exploring the information you can query, and write your own WMI scripts!