The Soul of a Virtual Machine

Things to know about running a virtual machine under Virtual Server

The Soul of a Virtual Machine

  • Virtual Machine Additions for Windows Server 2003 SP1

    The virtual machine team is "pedal to the metal" developing and testing an update for Virtual Machine Additions. This update will make Windows Server 2003 SP1 run better in virtual machines running under the release version of Virtual Server 2005. As soon as the new VM Additions are available, I'll let you know.
  • Virtual PC versus Virtual Server

    Althea wants to know what the difference is between Virtual PC and Virtual Server, and when she would use one versus the other. The fundamental difference between Virtual PC and Virtual Server is that Virtual PC is designed for desktop (or "client" or "PC") operating systems and Virtual Server is designed for server operating systems. As a result, the usage scenarios for the two products are correspondingly different. There are a few feature differences as well. This article covers the major functional differences between the two products.

    Supported operating systems

    For Virtual PC, both the host operating system (the one you install Virtual PC itself on) and the guest operating systems (the ones running inside virtual machines) will be desktop operating systems. Supported host operating systems include Windows XP Professional, Windows 2000 Professional, or Windows XP Tablet PC Edition. Supported guest operating systems include these plus a number of others, such as Windows 98 and MS-DOS 6.22. See the Virtual PC documentation for a complete list.

    For Virtual Server, the host operating system and the guest operating systems will be server operating systems. Supported host operating systems are Windows Server 2003 (Standard, Enterprise, and Datacenter Editions) and Windows Small Business Server (Standard and Premium Editions). Supported guest operating systems include these plus Windows 2000 Server, all editions except Enterprise as well as Windows NT Server 4.0 Enterprise Edition SP6a. See the Virtual Server documentation for more information.

    Usage scenarios for Virtual PC

    Some primary usage scenarios for Virtual PC are:

    • Support for legacy desktop applications. For example if you have applications  that were designed to run on Windows 98, but won’t run on your new Windows XP machine, you can run Windows 98 and your application in a virtual machine. Ben Armstrong uses Virtual PC to run his favorite DOS-based computer games. (For more info, see Ben's blog at http://blogs.msdn.com/Virtual_PC_Guy.)
    • Help desk. If you're a  help desk technician, you could set up a variety of desktop environments inside virtual machines to duplicate those of you client’s, so you could reproduce problems when clients call in.
    • Desktop application testing. If you're a developer, you can use virtual machines to test desktop applications in a variety of operating system environnments.
    • Training. If you're a trainer, you can set up your training programs to run inside virtual machines. This way you can offer more types of classes. In addition, you can set up the virtual machines to discard changes that were made during the class. This reduces setup time dramatically.

    These scenarios are described in detail in the white paper at: http://www.microsoft.com/windows/virtualpc/evaluation/techoverview.mspx.

    The uses that you can find for Virtual PC are limited only by your resourcefulness, though. For example, my co-worker Nehar has Virtual PC set up for his wife and kids to use for browsing the Internet. That way he doesn’t have to worry about anything they download because it won’t affect the host operating system. If the virtual machine get’s corrupted or infected, he can simply delete it and start over.

    Usage scenarios for Virtual Server

    Some primary usage scenarios for Virtual Server are:

    • Test and development for server applications. You can use Virtual Server in situations that require rapid and frequent server reconfiguration, as required with development and testing, product demonstrations, and training.
    • Application migration. You can move server applications running on older hardware and operating systems, such as Microsoft Windows NT® Server 4.0, onto virtual machines on newer, more resilient systems running Microsoft Windows Server 2003 operating systems, without rewriting the applications.
    • Server consolidation. Many companies have departmental and branch office servers that are underutilized. You can consolidate applications that require different server operating systems onto a single physical server to reduce the number of physical servers you need to maintain.

    Other differences between Virtual PC and Virtual Server

    Virtual Server provides a few features that aren’t available in Virtual PC:

    • Remote Management. You can administer Virtual Server remotely by using the Administration Web site.
    • Scalability.  Virtual Server scales across multiple processors (although in the current release each virtual machine can take advantage of only one CPU).
    • COM API.  You can manage Virtual Server and its virtual machines by using the COM API. For more information, see the Virtual Server SDK that ships with the product.
    • SCSI support. Virtual Server provides SCSI support.
    • Multiple CD-ROM drives: Although Virtual Server allows for virtual machines with multiple CD-ROM drives, Virtual PC supports virtual machines with only one CD-ROM drive.

    On the Virtual PC side, Virtual Server does not include an emulated sound card in its virtual machines, while Virtual PC does.

    That about sums it up as far as important functional differences. I hope this answered your question, Althea.

  • Tip: Speeding up application installation

    If you want your applications to install more quickly in a virtual machine, do this: After you install the guest operating system, install Virtual Machine Additions, restart the virtual machine, and then install the applications.
  • Tip: Accessing remote resources via UNC

    If you have a virtual machine configured on one computer and want to access a resource (such as an ISO or a VHD) on a different physical computer via a UNC path, you have three choices, listed below. The first two are covered in the documentation. The third is not, so consider it your tip for today.

    1. Enable Basic authentication on the Virtual Server Administration Website.
    2. Configure constrained delegation.
    3. Create a local account on the computer that hosts the resource you want to access, and then configure the virtual machine to run under that user account (for instructions, see "Modifying general virtual machine properties" in the Virtual Server 2005 Administrator's Guide).
  • Virtual Server 2005 Service Pack 1 - features and availability

    Here's what Kurt Schmucker, the program manager for Virtual Server 2005 Service Pack 1 says about the release:

    "As with typical service packs from Microsoft, Virtual Server 2005 Service Pack 1 will be primarily a rollup of fixes we have seen since the product was released to improve performance and increase scalability. In addition, with Service Pack 1, Virtual Server 2005 will have host support for Windows Server 2003 Service Pack 1 x64 Edition (note that this does not include IA64), provide PXE support, qualify Windows XP SP2 as a host and as a guest, and include the Virtual Disk Precompactor, a utility that is designed to "zero out" — that is, overwrite with zeros — any available blank space on a virtual hard disk. A public beta is slated for the end of first quarter 2005, with product release planned for the second half of calendar year 2005."

  • Branch Office Infrastructure Solution -- with automation tools

    The Branch Office Infrastructure Solution has been published on TechEd. It uses virtualization technologies and includes tools for automating the creation of virtual machines, among lots of other good stuff. Go take a look! http://www.microsoft.com/downloads/details.aspx?FamilyID=5624f3a5-b379-41c1-80f6-df3228cb2622&displaylang=en 

    From the download page: "The Branch Office Infrastructure Solution (BOIS) deliverables provide conceptual information to facilitate the definition and deployment of a streamlined branch office infrastructure solution that provides a comprehensive set of core IT infrastructure services based on the Microsoft® Windows Server™ 2003 operating system. The BOIS deliverables also include prescriptive guidance and best practices for implementing a complete, lab-validated single-server solution for the branch office using automated deployment tools. The automation tools are part of this download and are configurable for individual branch office deployments."

  • Domain in a box

    This article tells you how to set up a self-contained domain on a single computer under Virtual Server. Ed Reed, a virtualization developer here at Microsoft helped me out with it. Thanks Ed!

    Although you can set up a production domain controller on Virtual Server with lots of caveats (see Notes), the best reason to deploy a “domain in a box” is for development and testing purposes. For example, you might want to validate architecture or perform unit testing. For other types of testing, such as network analysis, function testing, capacity planning and resource utilization, you’d probably want to replicate the domain infrastructure in a test lab with multiple physical servers, rather than using the “domain in a box” configuration described in this article.

    To set up a domain in a box, you create and configure virtual machines running one or more domain controllers to reproduce the domain configuration that you want to test. You’ll probably want to create at least one virtual machine as a domain member as well. It isn’t a good idea to use the host operating system as a domain member because the domain controller must be available for the domain member to log onto the network. This would create a “chicken and egg” problem following a restart of the host computer.

    To configure networking, connect each virtual machine in the domain, including the domain controllers, to the “Internal” virtual network. This will isolate the network communication between the virtual machines to the internal virtual network on the host. You’ll also need to either assign static IP addresses to the virtual machines or else set up the DHCP server on the domain controller (not the virtual DHCP server provided by Virtual Server).

    The obvious way to test a domain configuration is to create a set of base VHDs and then enable differencing or undo disks before making the configuration changes that you want to test. Using differencing or undo disks with a domain controller, however, isn’t supported. The problem is that the base VHDs can become out of date and thus will be tombstoned. This happens when domain replication data is discarded when you discard the differencing or undo disk. To avoid this problem, let the domain controller(s) run when you’re not running a test so that they periodically replicate and never go beyond 180 days between replications. (Keep in mind that even if you do this, Microsoft Product Support won’t support using differencing and undo disks with a domain controller.)

    Notes:

    • In addition to this article, you should read the “Running Domain Controllers in Virtual Server 2005” whitepaper, especially if you’re considering setting up a production domain controller in a virtual machine. The whitepaper provides considerations and caveats, and explains the Microsoft support policy. It’s available at http://www.microsoft.com/downloads/details.aspx?FamilyId=64DB845D-F7A3-4209-8ED2-E261A117FC6B.
    • Before you perform a test using your domain in a box, you should back up your virtual hard disk (.vhd) files.
    • If you want to allow networking between the domain controllers running in your virtual machines and computers on an external network, you’ll need to connect the virtual machines to a virtual network that is attached to a physical network adapter with access to the external network. You would set this environment up the same way you would if the virtual machines were physical computers.
    • You can also configure a domain in a box on Virtual PC, but it is not supported. In this case, you’d attach the virtual machines to the Local Only network. Otherwise, the configuration would be the same.

     

  • New e-learning course on Virtual Server 2005

    Title: Course 2288: Using Microsoft® Virtual Server 2005
    Course Type: Self-paced course
    Available Offline: Yes
    Estimated Time to Complete: 5 hours
     
    Description:
    This course prepares students to migrate legacy applications and consolidate server functions by using Microsoft Virtual Server 2005. 
     
    Objectives:
    At the end of the course, students will be able to:

    • Install and configure Virtual Server 2005.
    • Configure virtual machines on Virtual Server 2005.
    • Migrate applications and servers to virtual machines.  

    Visit https://www.microsoftelearning.com/eLearning/offerDetail.aspx?offerPriceId=62154 for more information.

     

  • Recent articles on Microsoft's virtualization roadmap

    From ComputerWorld, "Q&A: Microsoft's Bob Muglia discusses virtualization plans" - http://www.computerworld.com/softwaretopics/software/story/0,10801,102332,00.html 

    Also from ComputerWorld, "Sidebar: Under the Hood: The Soul of a Virtual Machine" (they say imitation is the sincerest form of flattery!) - http://www.computerworld.com/hardwaretopics/storage/story/0,10801,101243,00.html

    From The Register, "Microsoft's Virtual Server to become a 'feature' in 2009" - http://www.theregister.co.uk/2005/06/08/ms_hypervisor_2009/ 

  • Increasing the speed of an OS install when using SCSI disks

    This article is contributed by Jeff Woolsey, our Virtual Server 2005 Program Manager. Thanks Jeff!

    To increase the performance of the OS install (F6 option) when using emulated SCSI disks you can create a diskette to load the faster SCSI drivers that are included with the Virtual Machine Additions.

    To create the disk:

    1. From the Virtual Server Web Administration application, create a Virtual Floppy Disk (.vfd). 
    2. Attach the .vfd to a running virtual machine with a CD-ROM drive.
    3. Attach the Virtual Machine Additions ISO to the virtual machine listed in the previous step.
    4. In the running virtual machine, navigate to the floppy drive
    5. Create a new file called TXTSETUP.OEM and copy and paste the following contents:

    [Disks]

    d1 = "Microsoft VM Accelerated Additions Driver Disk", \msvmscsi, \
    d2 = "Microsoft VM Accelerated Additions Driver Disk (NT4)", \msvmscsi, \nt4
    d3 = "Microsoft VM Accelerated Additions Driver Disk (Windows 2000)", \msvmscsi, \Win2000
    d4 = "Microsoft VM Accelerated Additions Driver Disk (Windows XP)", \msvmscsi, \WinXP
    d5 = "Microsoft VM Accelerated Additions Driver Disk (Windows Server 2003)", \msvmscsi, \Win2003

    [Defaults]

    scsi = MSVMSCSI_2003

    [scsi]
    MSVMSCSI_2003 = "(Windows Server 2003) Additions Accelerated SCSI Driver", msvmscsi
    MSVMSCSI_2000 = "(Windows 2000) Additions Accelerated SCSI Driver", msvmscsi
    MSVMSCSI_XP = "(Windows XP) Additions Accelerated SCSI Driver", msvmscsi
    MSVMSCSI_NT = "(nt4) Additions Accelerated SCSI Driver", msvmscsi


    [Files.scsi.MSVMSCSI_NT ]
    driver = d2, msvmscsi.sys, msvmscsi
    inf    = d2, msvmscsi.inf
    catalog = d2, vmadd_msvmscsi_sys.cat

    [Files.scsi.MSVMSCSI_2000 ]
    driver = d3, msvmscsi.sys, msvmscsi
    inf    = d3, msvmscsi.inf
    catalog = d3, vmadd_msvmscsi_sys.cat

    [Files.scsi.MSVMSCSI_XP ]
    driver = d4, msvmscsi.sys, msvmscsi
    inf    = d4, msvmscsi.inf
    catalog = d4, vmadd_msvmscsi_sys.cat

    [Files.scsi.MSVMSCSI_2003 ]
    driver = d5, msvmscsi.sys, msvmscsi
    inf    = d5, msvmscsi.inf
    catalog = d5, vmadd_msvmscsi_sys.cat

     

    [HardwareIds.scsi.MSVMSCSI_NT]
    id = "PCI\VEN_9004&DEV_7078&SUBSYS_70781414&REV_02","msvmscsi"

    [Files.scsi.MSVMSCSI_NT ]
    driver = d2, msvmscsi.sys, msvmscsi
    inf    = d2, msvmscsi.inf
    catalog = d2, vmadd_msvmscsi_sys.cat

    [HardwareIds.scsi.MSVMSCSI_2000]
    id = "PCI\VEN_9004&DEV_7078&SUBSYS_70781414&REV_02","msvmscsi"

    [Files.scsi.MSVMSCSI_2000 ]
    driver = d3, msvmscsi.sys, msvmscsi
    inf    = d3, msvmscsi.inf
    catalog = d3, vmadd_msvmscsi_sys.cat

    [HardwareIds.scsi.MSVMSCSI_XP]
    id = "PCI\VEN_9004&DEV_7078&SUBSYS_70781414&REV_02","msvmscsi"

    [Files.scsi.MSVMSCSI_XP ]
    driver = d4, msvmscsi.sys, msvmscsi
    inf    = d4, msvmscsi.inf
    catalog = d4, vmadd_msvmscsi_sys.cat

    [HardwareIds.scsi.MSVMSCSI_2003]
    id = "PCI\VEN_9004&DEV_7078&SUBSYS_70781414&REV_02","msvmscsi"

    [Files.scsi.MSVMSCSI_2003]
    driver = d5, msvmscsi.sys, msvmscsi
    inf    = d5, msvmscsi.inf
    catalog = d5, vmadd_msvmscsi_sys.cat

    6. Create a batch file in the guest operating system called setupf6.cmd and copy and paste the following contents:

    Set cddriveletter = d
    If not “%1” == “” set cddriveletter=%1
    Md a:\nt4
    Md a:\Win2000
    Md a:\WinXP
    Md a:\Win2003
    Dir > a:\msvmscsi
    Copy %cddriveletter%:\windows\windows\vmadd\winnt\*msvmscsi* a:\nt4
    Copy %cddriveletter%:\windows\windows\vmadd\win2k\*msvmscsi* a:\win2000
    Copy %cddriveletter%:\windows\windows\vmadd\Winxp\*msvmscsi* a:\WinXP
    Copy %cddriveletter%:\windows\windows\vmadd\Win2k3\*msvmscsi* a:\Win2003

    7. Execute the batch file
    a. If your virtual CDROM drive letter is d just execute setupF6.cmd
    b. If your virtual CDROM drive letter is a different letter execute setupF6.cmd <driveletter>.  (i.e.  If the virtual CDROM drive letter is “x” type “setupF6.cmd x”
    8. Remove the virtual floppy from the virtual floppy drive
    9. This disk can now be used as an ‘F6’ floppy disk during OS setup.

     

  • Migrating from virtual to physical

    Eric sent me this question: "Do you know if it's possible to migrate a virtual machine to a physical one using ADS or any other tool?"

    Unfortunately, I don't know of an easy way to migrate a virtual machine to a physical one, Eric, nor do I know of any tools. The issue is fixing the hardware-dependent system files. Because the hardware of a physical computer may be (or probably is) different than the hardware emulated by the virtual machine, you may need to swap system files that depend on the emulated hardware of the virtual machine for other files that will allow the operating system to run on the hardware of the physical computer. The system files include certain HAL and kernel files. You also may need to swap storage drivers needed for the operating system to boot correctly on the physical hardware. For more information about the hardware emulated by virtual machines, see "Emulated hardware" in the Virtual Server 2005 Administrator's Guide. If you want some background information on the issues, read the documentation I wrote for Virtual Server 2005 Migration Toolkit (VSMT). It's installed when you install VSMT (go to http://www.microsoft.com/windowsserversystem/virtualserver/evaluation/vsmt.mspx).

    The "gotcha" about swapping system files is that Microsoft won't support the OS if you've changed its HAL file. If you use VSMT, the migration is supported, but not if you do it manually.

    -Megan

  • Fixing network connectivity issues with Broadcom NICs

    Virtual Server sometimes takes issue with Broadcom NICs. If you're experiencing any connectivity problems, and you're using a Broadcom NIC, turn off the Offload TCP Segmentation, Checksum Offload, and Large Send Offload settings for the NIC, as follows (all of these settings may not be available):

    1. In the Network Connections control panel, right-click the connection and click "Properties."
    2. Click "Configure."
    3. In the Property list on the Advanced tab, select "Offload TCP Segmentation."
    4. In the Value box, select "Off."
    5. In the Property list, select "Checksum Offload."
    6. In the Value box, select "Off."
    7. In the Property list, select "Large Send Offload."
    8. In the Value box, select "Off," and then click "OK."

    The computer will restart.

    Note: When you change network adapter properties, the virtual machines attached to that adapter may loose their network connections. To restore the network connections, you must disconnect the affected virtual machines from the virtual network adapter that is attached to that physical network adapter and then reconnect them to it, as follows:

    1. From the Virtual Server Administration Website, shut down or turn off the virtual machine.
    2. On the virtual machine configuration page, click "Network adapters."
    3. In the "Connected to" box, select "Not connected," and then click "OK."
    4. In the "Connected to" box, select the virtual network adapter, and then click "OK."

    If this doesn't restore connectivity, then you'll need to restart the host computer.

  • MOM report for evaluating virtualization candidates

    Chong Lee and Thomas Mathew -- Technology Specialists here at Microsoft -- are developing a report that you can load into Microsoft Operations Manager 2005 (MOM) to monitor the performance of physical computers that are candidates for virtualization. This report can help you determine which computers are good candidates for virtualization, and of those, which computers you can virtualize on the same hardware. This report will be available for download when it's complete. I'll let you know where you can get it. In the meantime, you can ask your TAM or account rep for a copy.

    Click here to see a view of the report: http://megandavis.members.winisp.net/Resources/VS-Candidate-Report.JPG

  • Deploying Virtual Server: Q&A

    I just listened in on a conference call between Ben Armstrong (http://blogs.msdn.com/Virtual_PC_Guy) and Barbara, an IT manager who’s considering deploying Virtual Server in her enterprise. I thought you all might be interested in the questions and answers, so here are my notes:

    Barbara: What’s the difference between the standard and enterprise editions of Virtual Server 2005?

    Ben: CPU support. Standard supports up to four processors. Enterprise five plus. There are no other differences.

    Barbara. Is there a rule of thumb for selecting server candidates for virtualization?

    Ben: You need to look at the current load and availability of the server. Virtualization creates some overhead, so you’re not going to get the same performance from a virtualized server as from a physical one. The best candidates for virtualization are underutilized servers and servers running on older hardware. Many of our customers are also virtualizing infrastructure servers, such as domain controllers and DNS servers, which have a light load but need to run on a dedicated system. The Active Directory team has been great about working with us on this and has posted some prescriptive guidance for deploying domain controllers, including performance issues (http://www.microsoft.com/downloads/details.aspx?FamilyId=64DB845D-F7A3-4209-8ED2-E261A117FC6B&displaylang=en).

    Barbara: What should we be monitoring on our existing servers to help us with capacity planning?

    Ben: There is little memory overhead with virtual machines. You should allow the same amount of memory for your virtual machines as you did for the physical servers, plus a small buffer. More important is CPU and hard disk usage. One issue is disk contention. If you store VHD files on the same physical disk, and the workloads of the virtualized servers entail a lot of disk I/O, you can end up with contention.

    Barbara: What about special hardware, such as CD-ROM towers?

    Ben: This is a gray area. If you have a specialized PCI card, you can’t plug it into the virtual machine. But you can still make use of it if the card is supported by Windows Server 2003 and exposes services that Virtual Server can use. For example, you can configure the CD-ROM tower on the host, mount the CDs on your virtual machines, and then share them via the host operating system. Another example is that you can install a SCSI card on the host computer, attach hard drives to it, and store your VHDs on them.

    Barbara: How does IP addressing work with DNS?

    Ben: We create a unique MAC address for every virtual machine. External servers cannot tell it’s a virtual machine. Networking just works. In terms of network topology, we create a virtual switch and bridge the virtual machines to the outside world.

    Baraba: Do all virtual machines access the same NIC? Wouldn’t this create a bottleneck?

    Ben: Virtual machines can each have up to four virtual NICs. You can connect each virtual NIC to a physical NIC. If you have multiple virtual machines on the same NIC, Virtual Server divides the bandwidth among them. If you need more bandwidth, simply add more physical NICs and attach your virtual machines to them. Doing this is like connecting a network cable.

    Barbara: How do you assign resources?

    Ben: There are four areas of resource allocation:

    1. CPU. Each virtual machine can use up to one CPU. If you overload your physical CPU with the requirements of a lot of virtual machines, you can use resource allocation settings to set the relative weight given to specific virtual machines. You can also specify minimum and maximum amounts of CPU that will be available for each virtual machine.
    2. Memory. You can specify the amount of physical memory allocated to each virtual machine from 4 MB to 3.6 GB. When you power up the virtual machine, this amount of physical memory must be available on the host or the virtual machine won’t turn on.
    3. Hard disk. You create virtual hard disks (VHDs) that are used by virtual machines. They appear to be real hard disks, but they’re actually files with a .vhd extension that you store on a physical hard disk. There are two basic types of VHDs. Fixed VHDs have a fixed size, such as 20 GB, and do not grow. We recommend using fixed VHDs in production environments and when performance is a concern. The other type is dynamically expanding VHDs. When you first create this type of VHD, it’s very small. As you add data to the VHD, it grows up to the maximum size that you specified when you created it. We recommend using dynamically expanding VHDs only for personal use or test/development. This is because there’s a performance overhead for expanding the disk. In addition, dynamically expanding VHDs become fragmented more quickly.
    4. Networking. As we already discussed, Virtual Server evenly divides bandwidth between the virtual machines attached to the NIC, in addition to the host computer, if it is also using the NIC.

    Barbara: What if you attach the host to a SAN?

    Ben: You can use SAN storage for VHDs. This gives a performance advantage. The virtual machines won’t know they’re on a SAN. You can assign a physical disk to a physical computer. If you have two or more VHDs attached to a virtual machine – one for the operating system and the others for data – you can put all of the VHDs on the SAN. The virtual machine will then boot from the SAN, which is faster.

    Barbara: If we have, say two redundant HBA cards attached to the SAN, all the virtual machines would go through those cards. Wouldn’t this be a bottleneck?

    Ben: Yes, that could be a bottleneck, but we have a lot of customers doing this, and haven’t heard any complaints about performance so far.

    Barbara: What about storage on the host computer?

    Ben: If your VHDs are stroed on a SAN, the host computer doesn’t need much storage space. Virtual Server doesn’t require much disk space.

    Barbara: So you’d set up your NICs and HBAs, then you load your virtual machines.

    Ben: Right. Virtual Server goes through Windows for disk access. As long as the host operating system can present a drive, virtual machines can use it.

    Barbara: What about clustering?

    Ben: The solutions are complex, and we’re studying a number of different ones at this time. If you are clustering two physical servers, you only get protection if the entire server goes down. So we’re looking at using iSCSI for clustering virtual machines rather than hosts. If a single virtual machine goes down, then another host can pick it up.

    Barbara: What about backups?

    Ben: There are two ways to back up virtual machines. Virtual Server is like SQL or Exchange in that if you take an active backup, the files may be corrupt. So you can:

    1. Suspend the virtual machines and make a backup of the host computer.
    2. If you need 24 X 7 availability, you can install a backup agent on the virtual machines and back them up like you would any physical machines. You also should back up the configuration files, but this is simple and easy because they don’t change very often. [Note from Megan: For details on this, see the topic I wrote on backup and restore in the Virtual Server 2005 Administrator’s Guide.]

    Barbara: How often do you need to cold-boot the host computer?

    Ben: We’ve done extensive testing, and Virtual Server can run continuously for several months without a reboot. You only need to reboot when you install security patches. Because rebooting impacts the virtual machines, we recommend using a dedicated host computer to run Virtual Server that isn’t running any other applications. This will minimize reboots required by other applications.

    Barbara: Do you have performance issues with Linux guests?

    Ben: Linux isn’t an officially supported operating system. It runs, but we don’t have performance data on it. Some customers have reported, however, that they get fine performance.

    Barbara: How do you create images of guest operating systems?

    Ben: While you can use standard imaging tools with virtual machines, and they’ll work just fine, you don’t need to. You simply set up the guest operating system environment the way you want it (OS, version, language, applications, etc), run Sysprep, shut down the virtual machine, and then copy the VHD file. You create a new virtual machine specifying the copied VHD. When you start the virtual machine, it runs mini setup and assigns a unique name and SID. [It also gets a unique IP and MAC address.]

    Barbara: Are there tools that will help us figure out which servers are good candidates for virtualization?

    Ben: We’re working with partners on ways to measure utilization. Platespin has been doing a lot of work in this area. Microsoft is developing more prescriptive guidance, too. [For now we have the Solution Accelerator for Consolidating and Migrating LOB Applications, available at http://go.microsoft.com/fwlink/?LinkID=31616.]

    Barbara: What about tools that gather usage information on virtual machines?

    Ben: Tools that work on physical machines will work on virtual machines, although most of them don’t distinguish between virtual machines and physical machines. Many companies that offer management tools are adding this support. Virtual Server also provides performance counters on running virtual machines. Look at the host statistics. You can get a graph of virtual machine CPU usage versus host CPU usage.

    Barbara: What’s a standard setup for Virtual Server and Virtual machines in terms of processor and memory?

    Ben: What we see the majority of the time is a machine that has either 2-way or 4-way processors, 4 to 10 GB RAM, and 2 to 4 virtual machines per processor.

    Barbara: What type of workload do you recommend?

    Ben: Although there is a high demand for running SQL Server in virtual machines, we don’t recommend doing this in a production environment for performance reasons. Your best workloads are low usage and periodic usage applications.

  • Virtual PC vs. Virtual Server whitepaper now available for download

    This whitepaper is now available on Microsoft.com at http://download.microsoft.com/download/1/4/d/14d17804-1659-435d-bc11-657a6da308c0/VSvsVPC.doc. Thanks to those of you who gave me comments on the draft.

    Abstract: Microsoft® Virtual PC 2004 is a virtual machine solution for desktop operating systems. Microsoft Virtual Server 2005, on the other hand, is a solution for server operating systems. Although Virtual PC and Virtual Server share many features in common, they are designed for different purposes. As a result, some of their features are also quite different. This white paper explains the differences between Virtual PC and Virtual Server and discusses the scenarios in which it is appropriate to use one or the other.

  • Windows Server 2003 SP1 as a guest operating system

    As you may know, Windows Server 2003 SP1 has been released, and a lot of people will be rushing to upgrade their virtual machines. If you're thinking about doing this, though, plan on postponing it for a bit. Virtual Server 2005 was released many months before Windows Server 2003 SP1, and the Virtual Machine Additions are not optimized for it. You may be disapointed in the way your virtual machines run.

    But don't despair -- Virtual Server 2005 SP1 will include updated Virtual Machine Additions for Windows Server 2003 SP1 as well as the other new supported host and guest operating systems (see my earlier post on Virtual Server 2005 SP1 features). As soon as it's available, I'll let you know.

    ** The Beta release of Virtual Server 2005 SP1 is now available, as announced in this post: http://blogs.technet.com/megand/archive/2005/04/20/403960.aspx.**

    Note: If you upgrade your host operating system to Windows Server 2003 SP1, you may have trouble accessing the Administration Website. If this happens, you need to configure DCOM as described in this KB article: http://support.microsoft.com/?kbid=891609.

  • Sandboxing a virtual machine under Virtual PC

    Michael asked the following question about sandboxing a virtual machine. I thought it might be of general interest, so decided to post the answer, which Ben Armstrong, our resident Virtual PC guru has provided (http://blogs.msdn.com/Virtual_PC_Guy).

    Question: I'd like to use a virtual machine as a sandbox which permits the user to do "ugly" things in IE without damaging the host OS. Therefore, it is my interest to block any means of communication between host and guest, including drag and drop, network access, etc.
    1. Do you consider Virtual PC appropriate for this?
    2. How can I disable drag and drop?
    3. How can I disable guest access to the host without limiting Internet access?

    Answer (thanks Ben!): Yes – Virtual PC 2004 would be appropriate for this. To disable the integration features under a Windows 2000 or Windows XP virtual machine, you just need to disable the ‘Virtual Machine Additions Services Application’ and ‘Virtual Machine Additions Shared Folder Service’ services in the guest OS. To disable host access – but leave Internet access in place – use Shared Networking.

  • Sysprepping virtual machines

    You might want to create a “base” virtual machine with an operating system and applications, and then copy its .vhd file to use for other virtual machines. Before you make copies of the .vhd, however, it’s important to run Sysprep in the guest operating system. This way, the first time you start a virtual machine that uses a copy of the base virtual machine’s .vhd file, the guest operating system will be assigned a new SID and other identifiers, so you won’t end up with network conflicts between different virtual machines that use the same copied .vhd file.

     

    Read all about it in the article I just posted in the "Deployment" category at http://blogs.technet.com/megand/articles/357570.aspx.

     

    Please note that Microsoft does not support using a tool other than Sysprep for cloning virtual machines. For more information, see this Knowledge Base article: http://support.microsoft.com/Default.aspx?id=162001.

  • VirtualStrategy Magazine interview: PowerRecon

    Platespin CEO, Stephen Pollack, talked to VirtualStrategy Magazine about PowerRecon, Platespin's new tool for consolidation planning. Read all about it at http://www.virtual-strategy.com/article/articleview/778/1/2/.
  • Draft whitepaper: Virtual Server versus Virtual PC

    Update: This whitepaper is now available on Microsot.com at http://download.microsoft.com/download/1/4/d/14d17804-1659-435d-bc11-657a6da308c0/VSvsVPC.doc. Thanks to those of you who gave me comments on the draft.

    ------------------------------------------------------------------------

    Here's a draft of a whitepaper I'm working on that will ultimately be posted on Microsoft.com. Comments and suggestions would be appreciated. Thanks!

    ** This information is provided as-is with no warranties. **

    Introduction

    This whitepaper explains the difference between Virtual PC and Virtual Server, and discusses when you would use one versus the other. Virtual PC is Microsoft's virtual machine solution for desktop applications, and Virtual Server is its solution for server applications. While they share many features in common, because of their different usage scenarios, a number of their features are different.

    Virtual PC provides an optimal experience for a desktop user who wants to run one or more additional desktop operating systems on his or her PC. The user interface is fairly simple and there is extensive integration between the host operating system running on the physical computer and the guest operating systems running in virtual machines. For example, users can easily drag and drop data between virtual machines and their host. In addition, the sound and display features of virtual machines are much the same as physical computers.
    On the other hand, Virtual Server provides features to support the requirements of enterprise server applications and administration. For example, due to more stringent security requirements, there is less integration between the host and guest operating systems. Virtual Server also provides a number of features to support greater manageability, scalability, and extensibility.

    Virtual Server versus Virtual PC

    The fundamental difference between Virtual PC and Virtual Server is that Virtual PC is designed for desktop (or "client" or "PC") operating systems and Virtual Server is designed for server operating systems.

    While the two products have many features in common, they serve different needs, so there are crucial differences between them as well. For example, because it supports desktop applications, the Virtual PC user interface is designed with the typical desktop user in mind. The configuration options are relatively simple and easy for the average computer user to understand and use. On the other hand, Virtual Server is designed for running enterprise server operating systems and applications. It provides the configuration and management options that are required for server management, and these necessarily make the user interface more complex. As a result, making effective use of Virtual Server requires some degree of knowledge of server technologies.

    Usage scenarios for Virtual PC

    As already mentioned, Virtual PC is designed for running desktop operating systems and applications. Some primary usage scenarios for Virtual PC are:

    • Support for legacy desktop applications. For example if you have applications that were designed to run on Windows 98 that won’t run on your new Windows XP computer, you can run Windows 98 and your application in a virtual machine.
    • Help desk. If you're a help desk technician, you could set up a variety of desktop environments inside virtual machines to duplicate those of your clients, so you could reproduce problems when clients call in.
    • Desktop application testing. If you're a developer, you can use virtual machines to test desktop applications in a variety of operating system environnments.
    • Training. If you're a trainer, you can set up your training programs to run inside virtual machines. This way you can offer more types of classes. In addition, you can set up the virtual machines to discard changes that were made during the class. This dramatically reduces setup time.

    These scenarios are described in detail in the Microsoft Virtual PC 2004 Technical Overview white paper, available the Microsoft Web site at http://go.microsoft.com/fwlink/?LinkId=45404. The uses that you can find for Virtual PC are limited only by your resourcefulness, though. For example, you might set up Virtual PC for your family to use for browsing the Internet. That way you don’t have to worry about anything they download because it won’t affect the host operating system. If the virtual machine becomes corrupted or infected with a virus, you can simply delete it and start over.

    Usage scenarios for Virtual Server

    Virtual Server is designed for running enterprise server operating systems and applications. Some primary usage scenarios for Virtual Server are:

    • Test and development for server applications. You can use Virtual Server in situations that require rapid and frequent server reconfiguration, as required with development and testing, product demonstrations, and training. You can create a library of virtual machines in different server configurations without needing to dedicate a physical computer to each configuration. Your virtual machines then can be deployed from this library with a few mouse clicks. You can also set up the virtual machines to use Undo disks so that changes can be discarded, or you can use differencing disks to create a variety of configurations from one base disk. This is useful for many testing scenarios, such as software patch testing.
    • Server consolidation. Many companies have departmental and branch office servers that are underutilized. This is often because different departmental or branch office applications were written for different operating systems or different versions of the same operating system. To reduce the number of physical servers you must maintain, you can migrate these applications and operating systems into virtual machines running under Virtual Server on a single physical server.
    • Application migration. Many companies have server applications that require an older operating system, such as Microsoft Windows NT® Server 4.0. To upgrade to a newer, more resiliant system would require rewriting the applications, but doing this is often prohibitively costly. Instead of rewriting the applications though, you can move older operating systems and server applications into virtual machines running under Virtual Server and Microsoft Windows Server 2003.

    Shared features

    Virtual Server and Virtual PC have a number of features in common, such as:

    • Basic file architecture. Both Virtual Server and Virtual PC use the same file types for configuration and resource files. For example, virtual machine configuration files are .vmc files, virtual hard disk files are .vhd files, and saved state files are .vsv files. This common file architecture allows files (within certain limitations) to be shared between Virtual Server and Virtual PC.
    • Networking. Both Virtual Server and Virtual PC allow networking between virtual machines and physical machines. Virtual Server allows you to create and configure virtual networks, however.
    • Virtual machine control options. Options for controlling virtual machines, such as starting, stopping, shutting down, saving state are the same for Virtual Server and Virtual PC.
    • Disk features. Undo and differencing disks are available in both Virtual Server and Virtual PC.

    Feature differences

    While they share many features in common, due to the different usage scenarios there are also a number of differences between Virtual Server and Virtual PC, which are described in this topic.

    Unique features of Virtual PC

    To support the requirements of desktop users, Virtual PC provides the following features that are not available in Virtual Server:

    • Supported operating systems. For Virtual PC, both the host operating system (the one you install Virtual PC itself on) and the guest operating systems (the ones running inside virtual machines) must be desktop operating systems for Microsoft to support them. Supported host operating systems include Windows XP Professional, Windows 2000 Professional, or Windows XP Tablet PC Edition. Supported guest operating systems include these plus a number of others, such as Windows 98 and MS-DOS 6.22. See the Virtual PC documentation for a complete list.
    • Emulated sound card. Both Virtual Server and Virtual PC provide integration with the physical computer's mouse and keyboard. Only Virtual PC, however, provides an emulated sound card to support the needs and expectations of desktop users.
    • Extensive host-guest integration. One of the key goals in the design of Virtual PC was user convenience in a desktop environment. Users can switch between operating systems as easily as they switch between applications by simply clicking on the window containing the virtual machine. Users can copy, paste, drag and drop between the guest and host operating systems. They also can dynamically resize the guest operating system’s desktop when resizing the virtual machine window and share folders between operating systems
    • Shared networking. So that users can easily configure a connection to an external network that uses the host computer's network adapter, Virtual PC offers shared networking through network address translation (NAT).

    Unique features of Virtual Server

    To support the requirements of an enterprise environment, Virtual Server provides the following features that are not available (or needed) in Virtual PC:

    Supported operating systems

    For Virtual Server, supported host and guest operating systems are server operating systems, except for Windows XP Professional, which is supported as a host operating system. Supported host operating systems are Windows Server 2003 (Standard, Enterprise, and Datacenter Editions), Windows Small Business Server (Standard and Premium Editions), and Windows XP Professional. Supported guest operating systems include these plus Windows 2000 Server, all editions except Enterprise as well as Windows NT Server 4.0 Enterprise Edition SP6a. See the Virtual Server documentation for more information.

    Administration
    • Remote management. You can administer Virtual Server remotely by using the Web-based Administration Web site. You can also access and administer virtual machines remotely by using Virtual Machine Remote Control (VMRC).
    • Scripted management.  You can manage Virtual Server and its virtual machines by using the COM API. For more information, see the Virtual Server Programmer’s Guide included with the product.
    • WMI integration. Virtual Server provides WMI counters to the host operating system, which can be integrated into a non-Microsoft management solution or passed to Microsoft Operations Manager for monitoring and alerting.
    • Compatibility with Windows Server System management products. To deploy and manage virtual machines, you can use products such as Automated Deployment Services, Systems Management Server 2003 SP1, and Microsoft Operations Manager (MOM) 2005. There is a MOM management pack available for Virtual Server 2005.
    • Delegated administration. You can delegate administration and provide secure, authenticated guest access.
    • System event logging. Virtual Server logs events on the host operating system event log, which can be integrated into a non-Microsoft management solution, or passed to Microsoft Operations Manager for alerting. Virtual Server can send event notices—such as when a virtual machine session has stopped functioning—to external scripts.
    Scalability
    • SCSI support. Virtual Server supports virtual SCSI disks up to 2 TB in size.
    • Host multi-processor support.  Virtual Server scales across multiple processors on the host computer - up to 32. Each running virtual machine can take advantage of up to one CPU. For example, on a 32-processor host computer, you could allocate your CPU capacity so that 31 simultaneously running virtual machines would each use up to one CPU, leaving a CPU free for the host operating system. 
    • Multithreading. Virtual Server 2005 is a multithreaded application that runs as a system service, with each virtual machine running in its own thread of execution. In contrast, Virtual PC is a single-threaded application, and all simultaneously running virtual machines run on the same processor.
    • RAM. Support for up to 3.6 GB RAM per virtual machine.

    Security
    • Support for Secure Sockets Layer (SSL) security. For access to the Administration Website and the Virtual Machine Remote Control (VMRC) client, Virtual Server supports SSL security, as well as NTLM and Kerberos V5 authentication.
    • Configurable user context for virtual machines. By default, a virtual machine runs under the account of the user who turned it on. For added security, you can configure each virtual machine to run under a specified user account. Virtual machine scripts also run under this account, and it must be configured before virtual machine scripts can run.
    Resource management
    • Flexible memory and CPU allocation. Virtual Server supports flexible memory configuration and dynamic CPU resource allocation for each virtual machine.
    Other enterprise features
    • Virtual networking. Virtual Server allows you to create an unlimited number of virtual networks, each with its own virtual DHCP server. It also allows you to configure DNS and WINS servers, IP addresses and IP address lease time.
    • Two-node clustering. Virtual Server provides simple two-node failover from one virtual machine to another for testing and development.

    Additional Information

    The following are references to additional information and resources for using Virtual PC and Virtual Server.

  • Script to perform a warm backup of a virtual machine

    Here's an example of a script written in VBScript that you can write to perform a warm backup of a virtual machine. It was written by John Kelbley, who's a technology specialist for Microsoft. Please pay attention to the warnings and caveats given in the script.

    Thanks John!

    ' READ THIS LINE!!!   The sample scripts are not supported under any Microsoft standard support program or service.  The sample scripts are provided AS IS without warranty of any kind.  Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose.  The entire risk arising out of the use or performance of the sample scripts and documentation remains with you.  In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.
    '
    '
    ' MoveWarm.VBS  written by John Kelbley
    '
    '
    ' This the mother of all Demo Virtual Server Availability scripts! 
    '
    ' When the script is executed properly from a running Virtual Server system with active Guest images,
    ' it hibernates, copies, installs, and starts all active Guest images on another Virtual Server!
    '
    ' This could be used in a production environment to allow for hardware maintenance while minimizing down time of Guest images, if all assumptions are met, including:
    ' Identical Virtual Server hardware configuration - enough RAM, disk space with same drive letters, etc. on target to accommodate migrated guest images
    ' Identical Virtual Network configuration (it's just easier, otherwise, they may not start automatically, and you'll have to adjust the config)
    ' Other things I haven't run into in my testing (I only have a couple of Evo's to test on!)
    ' XP SP2 (connection firewall) can keep this from running, depending on the hosts you are using (rumor that some DCOM security thing might mess things up, too)
    ' I sometimes have been know to setup a local account on both hosts with the same name and password as my domain credential, and map drives back and forth to
    ' make sure everything will run right before kicking off the script for a demo!
    '
    ' NAME RESOLUTION IS A BIG DEAL HERE TOO!!!
    '
    ' How does the Script do it?  It does a few key things:
    ' 1) "saves state" on running VPC images
    ' 2) Creates a .BAT and .VBS on original host for each of the hibernated images in current directory
    ' 3) Starts .BAT for each hibernated image on local host (this kind of multi-threads the copy)
    '  a) copies files related to image to new host (.VHD config, save state)
    '  b) runs .VBS to register config file on new host, and re-start from Saved State
    '
    ' The script does not clean up after itself, as it is a sample meant for training purposes!
    '
    ' The .BAT and .VBS files generated may be of interest to someone, so at this time, I did not want to delete them
    '
    '
    ' When I run the demos, I usually use smaller VMs  - some from the VMSTORE areas - like Windows 3.0 or BOB on Windows 95
    '
    '
    ' Thanks to the Tech Net Script Center folks for all their guidance (great examples on the web, as well as usable reference books on VBS!)
    '
    '
    Option Explicit
    'On Error Resume Next

    Const ForWriting = 2 ' constant used for openning text files

    Dim ToSystem  ' Computer Name of Target host system
    Dim FromSystem  ' Computer Name of source host system
    Dim VMStateCodes ' Array of VM State Codes - to display kinder status that integers
    Dim VMStuff  ' Virtual Server Info instance
    Dim SourcevmCollection ' Collection of VMs from Source Server
    Dim vm   ' instance of a VM from collection loop
    Dim objVM  ' instance of a VM
    Dim MoveVM  ' instance of a VM
    Dim colHardDisks  ' Collection of VHDs in a VM
    Dim objDrive  ' instance of a VHD from collection loop
    Dim objHardDisk  ' instance of a VHD
    Dim NameLength   '   for tidy display of VM names
    Dim MaxNameLength  '  for tidy display of VM names
    Dim VMCount  ' counter for all VMs
    Dim MoveCount  ' counter for VMs to move - VMs that are currently running (nicer demo!)
    Dim MoveName  ' local var with VM name
    Dim VMInfo(100)  ' array of VM names to be moved
    Dim TargetHost  ' The server where all the runnning VM's will be moved
    Dim TargetHostServer ' The server where all the runnning VM's will be moved
    Dim TargetHostAvailable ' Boolean to track if the target host is pingable
    Dim MyShell   '  Used to find local host name, if required
    Dim MyEnvironment  '  Used to find local host name, if required


    ' Set Target host variables
    'TargetHost = "192.168.0.3" ' put name or IP Address of target server here, NOT preceeded by two slashes
    'TargetHost = "WS03VS01"  ' put name or IP Address of target server here, NOT preceeded by two slashes
    TargetHost = "CHANGEME"  ' put name or IP Address of target server here, NOT preceeded by two slashes


    '
    ' Should not need to change anything after here to get script to run!
    '
    TargetHostServer = "\\" & TargetHost
    TargetHostAvailable = TRUE  ' setting default before ping test

    Call Housekeeping()

    VMCount = 0
    Set SourcevmCollection = VMStuff.VirtualMachines
    '
    ' Get maximum Name Length for Formatting - just makes some things look nice
    '
    For each vm in SourcevmCollection
     NameLength = Len(vm.Name)
     If MaxNameLength < NameLength Then
      MaxNameLength = NameLength
     End If
     '
     ' If VM is "Running" them target for WARM migration to other host system
     ' Here is where the systems are identifed at migration targets
     '
     if VMStateCodes(vm.State) = "Running" Then
      VMInfo(VMCount) = vm.Name
      VMCount = VMCount + 1
     End If
    Next

    For each vm in SourcevmCollection
       Wscript.Echo VbCrLf & "--------------------------------------------------------------------"
     Wscript.Echo "     " & vm.Name & Space(MaxNameLength - Len(vm.Name)) & " - State is:  " & VMStateCodes(vm.State)
    Next

    Wscript.Echo VbCrLf & "--------------------------------------------------------------------"
    Wscript.Echo "--------------------------------------------------------------------"
    if VMCount = 0 then
     Wscript.Echo VbCrLf & "No VMs are runnning, nothing to warm move"
    End If

    '****************************************************
    ' Engine is here!!!!!
    '****************************************************
    if TargetHostAvailable = TRUE Then
     For MoveCount = 1 to VMCount
      MoveName = VMInfo(MoveCount-1)
      Wscript.Echo "Processing " & MoveName & Space(MaxNameLength - Len(MoveName)) & " VM " & MoveCount & " of " & VMCount & "..."
      Set objVM = VMStuff.FindVirtualMachine(MoveName)

      ' Save State of all running VMs
      Call SaveVMState(MoveName)

      ' Generage .BAT and .VBS for each of the running VMs
      Call MakeScriptFiles(MoveName)

     Wscript.Echo VbCrLf & "--------------------------------------------------------------------"
     Next
    End If

     

    Wscript.Echo VbCrLf & "--------------------------------------------------------------------"
    Wscript.Echo "--------------------------------------------------------------------"
    'End Script

    '******************************************************************************
    '******************************************************************************
    '******************************************************************************
    '******************************************************************************
    '*                                                                            *
    '*                                                                            *
    '*            Subroutines to make the stuff up top look nicer!                *
    '*                                                                            *
    '*                                                                            *
    '*                                                                            *
    '******************************************************************************
    '******************************************************************************
    '******************************************************************************
    '******************************************************************************


    '******************************************************************************
    '*                                                                            *
    '*     Do some if the ugly stuff that I didn't want to put at the front       *
    '*     of the script                                                          *
    '*                                                                            *
    '******************************************************************************
    Sub Housekeeping()

     Dim objPing ' use for ping test - poached from TechNet examples
     Dim objStatus  ' use for ping test - poached from TechNet examples

     Wscript.Echo VbCrLf & "--------------------------------------------------------------------"
     Wscript.Echo VbCrLf & "-                                                                  -"
     Wscript.Echo VbCrLf & "-                                                                  -"
     Wscript.Echo VbCrLf & "-                        WarmMove.VBS                              -"
     Wscript.Echo VbCrLf & "-                                                                  -"
     Wscript.Echo VbCrLf & "-                             by                                   -"
     Wscript.Echo VbCrLf & "-                                                                  -"
     Wscript.Echo VbCrLf & "-             John Kelbley                                 -"
     Wscript.Echo VbCrLf & "-                                                                  -"
     Wscript.Echo VbCrLf & "-                                                                  -"
     Wscript.Echo VbCrLf & "-    Finds running VM's running under Virtual Server 2005          -"
     Wscript.Echo VbCrLf & "-    on local system, pauses them, moves them to specified target  -"
     Wscript.Echo VbCrLf & "-    and unpauses them!                                            -"
     Wscript.Echo VbCrLf & "-                                                                  -"
     Wscript.Echo VbCrLf & "-    Please read comments in script carefully before running!      -"
     Wscript.Echo VbCrLf & "-                                                                  -"
     Wscript.Echo VbCrLf & "-    This is a sample, and is not meant for use in production.     -"
     Wscript.Echo VbCrLf & "-                                                                  -"
     Wscript.Echo VbCrLf & "-    Script expects NO paramameter - the name of the target        -"
     Wscript.Echo VbCrLf & "-    Virtual Server host is specified internally                   -"
     Wscript.Echo VbCrLf & "-    (I WANT YOU TO LOOK AT THE SCRIPT!!!!)                        -"
     Wscript.Echo VbCrLf & "-                                                                  -"
     Wscript.Echo VbCrLf & "-                                                                  -"
     Wscript.Echo VbCrLf & "-      Example:   cscript MoveWarm.VBS                             -"
     Wscript.Echo VbCrLf & "-                                                                  -"
     Wscript.Echo VbCrLf & "-                                                                  -"
     Wscript.Echo VbCrLf & "-                                                                  -"
     Wscript.Echo VbCrLf & "--------------------------------------------------------------------"

     ' Populate VM State Array
     VMStateCodes = Array("Invalid", "Turned Off","Saved","Turning On", "Restoring", "Running", "Paused", "Saving",_
        "Turning Off", "Merging Drives", "Deleting Machine")

     ' Create VS application instance
     Set VMStuff = WScript.CreateObject("VirtualServer.Application")

     Wscript.Echo VbCrLf & "Source Host System (this box!): " & FromSystem

     Wscript.Echo VbCrLf & "--------------------------------------------------------------------"

     Wscript.Echo "Default VM configuration path: " & VMStuff.DefaultVMConfigurationPath
     Wscript.Echo "Default VN configuration path: " & VMStuff.DefaultVNConfigurationPath


     ' Check to see if remote target system is accessible...
     '
     Wscript.Echo VbCrLf & "Pinging  " & TargetHost & " to see if warm migration can occour..."
     Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_PingStatus where address = '" & TargetHost & "'")
     For Each objStatus in objPing
      If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then
       TargetHostAvailable = FALSE
       WScript.Echo VbCrLf & "machine " & TargetHost & " is not reachable"
       WScript.Echo "CANNOT EXECUTE Warm migration" & VbCrLf 
      End If
     Next
     '***********************************************************************************
     ' should add a check to see if remote system has Virual Server installed, too!!!!!
     '***********************************************************************************
    End Sub

     

    '******************************************************************************
    '*                                                                            *
    '*     Saves the State of Running VMs - creating a "hibernated" VM            *
    '*                                                                            *
    '******************************************************************************
    Sub SaveVMState(subVMName)
     Wscript.Echo Space(MaxNameLength + 12) & "Saving State"
     While objVM.State > 2 ' if the VM is not turned off of saved...
      if VMStateCodes(objVM.State)  = "Running" Then
       objVM.Save()
     End If
      wscript.sleep(1000)        
      Wscript.Echo Space(MaxNameLength + 12) & VMStateCodes(objVM.State)
     Wend
    End Sub


    '******************************************************************************
    '*                                                                            *
    '*     Generate .BAT and .VBS files to handle the migration of VM files       *
    '*                                                                            *
    '******************************************************************************
    Sub MakeScriptFiles(subVMName)

     Dim LocalBatchFile 
     Dim LocalVBSFile 
     Dim LocalFSO
     Dim LocalFile
     Dim FileFSO
     Dim FileToCheck
     Dim FoundFolder
     Dim FromFileConfig
     Dim ToFileConfig
     Dim ConfigFolder
     Dim FromFileState
     Dim ToFileState
     Dim FromFileVHD
     Dim ToFileVHD
     Dim FromFileVUD
     Dim ToFileVUD
     Dim CommandString
     Dim objShell

     Set MoveVM = VMStuff.FindVirtualMachine(subVMName)
     Wscript.Echo VbCrLf & "Beginning Move Processing..."

     ' ***********************************************************************************************************************
     ' ***********************************************************************************************************************
     ' code to create .BAT to copy files and call .VBS to register config file and start image
     ' ***********************************************************************************************************************
     ' ***********************************************************************************************************************
     LocalVBSFile = subVMName & "_" & "local.vbs" 
     LocalBatchFile = subVMName & "_" & "local.bat" 


     Set LocalFSO = CreateObject ("scripting.FileSystemObject")
     Set LocalFile = LocalFSO.CreateTextFile(LocalBatchFile)

     ' start writing batch file
     LocalFile.WriteLine "@Echo off"
     LocalFile.WriteLine "Echo ---------------------------------------------------------"

     ' Construct destination UNC for Config File to copy
     ' Need the path for the parent directory of the file to copy to make Xcopy work right...this seemed easier than parsing the string!
     FromFileConfig = MoveVM.File
     Set FileFSO = CreateObject("Scripting.FileSystemObject")
     Set FileToCheck = FileFSO.GetFile(FromFileConfig)
     FoundFolder = FileFSO.GetParentFolderName(FileToCheck)
     ConfigFolder = FoundFolder ' Saving this for the VBS later...
     ToFileConfig = TargetHostServer & "\" & Left(FoundFolder, 1) & "$" & Mid(FoundFolder, 3, 1024)
     CommandString = "xcopy " & CHR(34) & FromFileConfig & CHR(34) & " " & CHR(34) & ToFileConfig & "\" & CHR(34) & " /Y"
     LocalFile.WriteLine "echo Copying " &  FromFileConfig & " to remote, please wait..."
     LocalFile.WriteLine CommandString
     LocalFile.WriteLine "Echo ---------------------------------------------------------"

     ' Construct destination UNC for Save State File n
     FromFileState = MoveVM.SavedStateFilePath
     Set FileFSO = CreateObject("Scripting.FileSystemObject")
     Set FileToCheck = FileFSO.GetFile(FromFileState)
     FoundFolder = FileFSO.GetParentFolderName(FileToCheck)
     ToFileState = TargetHostServer & "\" & Left(FoundFolder , 1) & "$" & Mid(FoundFolder, 3, 1024)
     CommandString = "xcopy " & CHR(34) & FromFileState & CHR(34) & " " & CHR(34) & ToFileState & "\" & CHR(34) & " /Y"
     LocalFile.WriteLine "echo Copying " &  FromFileState & " to remote, please wait..."
     LocalFile.WriteLine CommandString
     LocalFile.WriteLine "Echo ---------------------------------------------------------"

     ' Take Care of VHD (drive image) and VUD files (undo files) - can be more than one for a Guest...
     Set colHardDisks = MoveVM.HardDiskConnections
     For Each objDrive in colHardDisks
             FromFileVHD = objDrive.HardDisk.File
      Set FileFSO = CreateObject("Scripting.FileSystemObject")
      Set FileToCheck = FileFSO.GetFile(FromFileVHD)
      FoundFolder = FileFSO.GetParentFolderName(FileToCheck)
      ToFileVHD = TargetHostServer & "\" & Left(FoundFolder, 1) & "$" & Mid(FoundFolder, 3, 1024)
      CommandString = "xcopy " & CHR(34) & FromFileVHD & CHR(34) & " " & CHR(34) & ToFileVHD & "\" & CHR(34) & " /Y"
      LocalFile.WriteLine "echo Copying " &  FromFileVHD & " to remote, please wait...(big file!)"
      LocalFile.WriteLine CommandString
      LocalFile.WriteLine "Echo ---------------------------------------------------------"
            If MoveVM.Undoable Then
         FromFileVUD = objDrive.UndoHardDisk.File
       Set FileFSO = CreateObject("Scripting.FileSystemObject")
       Set FileToCheck = FileFSO.GetFile(FromFileVUD)
       FoundFolder = FileFSO.GetParentFolderName(FileToCheck)
       ToFileVUD = TargetHostServer & "\" & Left(FoundFolder, 1) & "$" & Mid(FoundFolder, 3, 1024)
       CommandString = "xcopy " & CHR(34) & FromFileVUD & CHR(34) & " " & CHR(34) & ToFileVUD & "\" & CHR(34) & " /Y"
       LocalFile.WriteLine "echo Copying " &  FromFileVUD & " to remote, please wait..."
       LocalFile.WriteLine CommandString
       LocalFile.WriteLine "Echo ---------------------------------------------------------"
      End If
     Next

     ' Call .VBS to register configuration file and start the VPC image
     LocalFile.WriteLine "Echo Calling script to register config file on remote and start VM..."
     LocalFile.WriteLine "CScript " & CHR(34) & LocalVBSFile & CHR(34) & " //NoLogo"

     LocalFile.WriteLine "Echo  End of Batch file"
     LocalFile.WriteLine "Echo ---------------------------------------------------------"
     LocalFile.Close  'close batch file


     ' ***********************************************************************************************************************
     ' ***********************************************************************************************************************
     ' code to create .VBS to register config file with Target Virtual Server
     ' ***********************************************************************************************************************
     ' ***********************************************************************************************************************
     Set LocalFSO = CreateObject ("scripting.FileSystemObject")
     Set LocalFile = LocalFSO.CreateTextFile(LocalVBSFile)

     ' start writing .VBS file
     ' LocalFile.WriteLine "On Error Resume Next"
     LocalFile.WriteLine "Set objVS = CreateObject(" & CHR(34) & "VirtualServer.Application" & CHR(34) & ", "  & CHR(34) & TargetHostServer & CHR(34) & ")"
     LocalFile.WriteLine "errReturn = objVS.RegisterVirtualMachine(" & CHR(34) & subVMName  & CHR(34) & "," & CHR(34) & ConfigFolder & CHR(34) & ")"
     LocalFile.WriteLine "Set objVM = objVS.FindVirtualMachine(" & CHR(34) & subVMName  & CHR(34) & ")"
     LocalFile.WriteLine "objVM.Startup()"

     LocalFile.Close  'close .VBS file
     
     Set objShell = Wscript.CreateObject("Wscript.Shell")
     CommandString = "%comspec% /c " & CHR(34) & LocalBatchFile & CHR(34)
     Wscript.Echo VbCrLf & "Command string:  " & CommandString
     objShell.Run(CommandString)

     Wscript.Echo VbCrLf & "End Move Processing"
    End Sub

  • Steve Ballmer on Microsoft's virtualization strategy

    In his keynote address this morning at Microsoft Management Summit 2005, Steve Ballmer reaffirmed Microsoft's commitment to the Dynamic Systems Initiative (DSI), of which virtualization is a key component. Ballmer explained that Microsoft is increasing investment in both virtualization and virtualization management technology, describing near-term product improvements and laying out a long-term strategy for both areas. For a summary of Steve's keynote address, go to http://www.microsoft.com/presspass/press/2005/Apr05/04-20VirtualizationInvestmentsPR.asp. For a verbatim transcript of his comments on virtualization, go to http://blogs.technet.com/megand/articles/403997.aspx. To view an on-demand Web cast (including Jeff Woolsey's demonstration of Virtual Server 2005 SP1), go to http://www.microsoft.com/presspass/events/mgmtsummit/keynotes.asp.

  • Virtual Server script repository

    You probably already know that Virtual Server provides a complete set of COM interfaces for programmatic management (see Start > All Programs > Microsoft Virtual Server > Virtual Server Programmer's Guide). But did you know about the Virtual Server script repository on TechNet? It contains sample scripts for tasks such as managing virtual hard disks, configuring Virtual Server and virtual machines, configuring security, and managing virtual networks.You can find the repository at http://www.microsoft.com/technet/scriptcenter/scripts/vs/default.mspx.

  • STC presentation slides (off topic)

    This is not related to Virtual Server, so skip this unless you're looking for my STC slides.

    Below is a link to the presentation slides for my STC talk on using newsgroups to improve the customer experience. At the bottom of each slide are my detailed notes. To view them more easily, you can drag the divider bar upwards. Happy posting!

    Megan

    http://megandavis.members.winisp.net/Resources/Newsgroups_MD.mht

  • Script: Generate a list of virtual machines

    These two scripts from John Kelbley, written in VBScript, list the virtual machines that are currently registered on a given instance of Virtual Server. Remember that these scripts are provided as-is, with no warranties, and are not supported by Microsoft.

    This script shows the virtual machines registered on the current instance of Virtual Server:

    Set vpcApp = CreateObject("VirtualServer.Application")

    Set vmCollection = vpcApp.VirtualMachines

    For each vm in vmCollection
     Wscript.Echo vm.Name

    Next

    This script shows the virtual machines registered on a remote instance of Virtual Server:

    Set vpcApp = CreateObject("VirtualServer.Application“,_ “\\remoteServer”)

    Set vmCollection = vpcApp.VirtualMachines

    For each vm in vmCollection
     Wscript.Echo vm.Name

    Next