<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>David Wang : Virtual Server</title><link>http://blogs.msdn.com/david.wang/archive/tags/Virtual+Server/default.aspx</link><description>Tags: Virtual Server</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>HOWTO: Monitor Virtual Server Events</title><link>http://blogs.msdn.com/david.wang/archive/2006/06/29/HOWTO-Monitor-Virtual-Server-Events.aspx</link><pubDate>Thu, 29 Jun 2006 15:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:650686</guid><dc:creator>Anonymous</dc:creator><slash:comments>9</slash:comments><comments>http://blogs.msdn.com/david.wang/comments/650686.aspx</comments><wfw:commentRss>http://blogs.msdn.com/david.wang/commentrss.aspx?PostID=650686</wfw:commentRss><wfw:comment>http://blogs.msdn.com/david.wang/rsscomments.aspx?PostID=650686</wfw:comment><description>&lt;P&gt;I think Virtual Server Events and Asynchronous Tasks are two of the least utilized features of the Virtual Server Administration API.&lt;/P&gt;
&lt;P&gt;Contrary to the often-asked task of "find the VM, turn it off, manipulate its VHD, then turn it back on", which shows the synchronous, task-driven side of the VS Admin model, Events and Asynchronous Tasks show off a nice event-based, asynchronous model suitable for passive monitoring and response. What good is this?&lt;/P&gt;
&lt;P&gt;Well... that's the motivation behind this blog entry's sample code, which illustrates a simple "Virtual Server Monitor Agent" which does a few basic things:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;By default, it simply monitors all Virtual Server events and reports them to the console window. Assuming you named the JScript code VSMonitor.js, just launch it from the commandline with:&lt;BR&gt;START CSCRIPT VSMonitor.js 
&lt;LI&gt;Thereafter, whenever you start a Virtual Machine, a new child monitor script will pop up and monitor just that Virtual Machine 
&lt;LI&gt;If that Virtual Machine has a Virtual DVD drive, they will also be monitored for media insertion/ejection and type (ISO or drive letter path) 
&lt;LI&gt;When you turn off a Virtual machine, its associated child monitor script will also terminate (but it will first popup a message telling you this, in case you missed it). 
&lt;LI&gt;It also notices when you fail to startup a Virtual Machine due to Out-of-Memory and report that via a popup&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;The sample basically illustrates how to:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Sync on Virtual Server wide events 
&lt;LI&gt;Act on a Virtual Server wide event 
&lt;LI&gt;Sync on Virtual Machine specific events 
&lt;LI&gt;Act on&amp;nbsp;a Virtual Machine specific event 
&lt;LI&gt;Sync on Virtual DVD specific events 
&lt;LI&gt;Report on Virtual DVD events&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;And it should provide enough information for you to play around, note when events happen, and note available data for the event... and implement other interesting ideas supported by the API.&amp;nbsp;I don't have any in mind, but if you do... feel free to share... because then I may update this sample to do something more interesting. :-)&lt;/P&gt;
&lt;P&gt;Enjoy.&lt;/P&gt;
&lt;P&gt;//David&lt;/P&gt;&lt;FONT color=#008000&gt;&lt;PRE&gt;var strVMName = "sample VM Name";
var CRLF = "\r\n";
var NO_WAIT = false;
var VISIBLE = 1;

var ERROR_VM_NOT_FOUND = -2146828283;
var ERROR_VM_OUT_OF_MEMORY = 3238134821;

var fSignaled = false;
var fPopup = true;
var cPeriod = 10000;

var VM_STATE_STRING = {
    0 : "Invalid",
    1 : "Off",
    2 : "Saved",
    3 : "Turning on",
    4 : "Restoring",
    5 : "Running",
    6 : "Paused",
    7 : "Saving",
    8 : "Turning off",
    9 : "Merging drives",
    10 : "Deleting VM"
};
var VM_STATE_OFF = 1;
var VM_STATE_RUNNING = 5;

var objVS = null;
var objVM = null;
var objDVD = null;
var objShell = null;
var enumObjs;
var enumObj;

if ( WScript.Arguments.Length &gt; 0 )
{
    strVMName = WScript.Arguments.Item( 0 );
}

try
{
    objShell = new ActiveXObject( "WScript.Shell" );
    objVS = new ActiveXObject( "VirtualServer.Application" );

    try
    {
        //
        // Try to locate the specified VM and listen for its events
        // If fail to locate VM, just listen for VS-wide events
        //
        objVM = objVS.FindVirtualMachine( strVMName );
        WScript.ConnectObject( objVM, "VirtualMachineEvent_" );

        //
        // If the VM has any DVD drives, listen for their changes, too
        //
        enumObjs = new Enumerator( objVM.DVDROMDrives );

        for ( ; !enumObjs.atEnd(); enumObjs.moveNext() )
        {
            objDVD = enumObjs.item();
            WScript.ConnectObject( objDVD, "VirtualDVDEvent_" );
        }
    }
    catch ( e )
    {
        if ( e.number == ERROR_VM_NOT_FOUND )
        {
            LogEcho( "Failed to find VM " + strVMName + "." );
        }
        else
        {
            LogEcho( formatErrorString( e ) );
        }

        objVM = null;
        WScript.ConnectObject( objVS, "VirtualServerEvent_" );
    }

    LogEcho( "Waiting for Events from: " + CRLF +
             ( objVM  != null ? "- VM " + strVMName + CRLF : "- VS Wide" ) +
             ( objDVD != null ? "- DVD Drive(s)" + CRLF : "" ) +
             "" );

    //
    // Poll every cPeriod time period to determine if should exit
    //
    while ( !fSignaled )
    {
        WScript.Sleep( cPeriod );
    }
}
catch ( e )
{
    LogEcho(
        formatErrorString( e ) + CRLF +
        ( objShell == null ?
            "Failed to create WScript.Shell - check:" + CRLF +
            "- %windir%\System32\WSHOM.OCX is ACLed for user" + CRLF +
            "- Scripts are allowed by Personal Security products" + CRLF :
            "" ) +
        ( objVS == null ?
            "Failed to create Virtual Server COM object - check:" + CRLF +
            "- Virtual Server is installed" + CRLF +
            "- User has Control/Execute Access in VS Security" + CRLF :
            "" )
            );
    LogEcho( "Waiting a few seconds for you to read this..." );
    WScript.Sleep( cPeriod );
}

function LogEcho( str )
{
    WScript.Echo( str );
}

function LogPopup( str )
{
    if ( fPopup )
    {
        objShell.Popup( str );
    }
    else
    {
        LogEcho( str );
    }
}

function formatErrorString( objError )
{
    return "(" + Int32ToHRESULT( objError.number ) + ")" + ": " +
           objError.description;
}

function Int32ToHRESULT( num )
{
    if ( num &lt; 0 )
    {
        return "0x" + new Number( 0x100000000 + num ).toString( 16 );
    }
    else
    {
        return "0x" + num.toString( 16 );
    }
}

//
// Virtual Server Events
//
function VirtualServerEvent_OnEventLogged( e )
{
    LogEcho( "VirtualServer_OnEventLogged: (Event ID) " + e );

    if ( e == ERROR_VM_OUT_OF_MEMORY )
    {
        LogPopup( "Cannot start VM due to out of memory" );
    }
}
function VirtualServerEvent_OnHeartbeatStopped( e )
{
    LogEcho( "VirtualServer_OnHeartbeatStopped: (VMName) " + e );
}
function VirtualServerEvent_OnServiceEvent( e )
{
    LogEcho( "VirtualServer_OnServiceEvent: (Event ID) " + e );
}
function VirtualServerEvent_OnVMStateChange( e, s )
{
    var retVal;
    LogEcho( "VirtualServer_OnVMStateChange: VM " + e + " " +
             "changed to state " + s + "(" + VM_STATE_STRING[ s ] + ")" );
    switch ( s )
    {
        case VM_STATE_RUNNING:
            LogEcho( "Running " + WScript.ScriptFullName +
                     " to monitor VM " + e );
            retVal = objShell.Run(
                        "CSCRIPT.EXE" + " " +
                        "\"" + WScript.ScriptFullName + "\"" + " " +
                        "\"" + e + "\"",
                        VISIBLE,
                        NO_WAIT );
            break;
    }
}

function VirtualMachineEvent_OnConfigurationChanged( e, s )
{
    LogEcho( "VirtualMachine_OnConfigurationChanged: " + strVMName + " " +
             "config " + e + " = " + "\"" + s + "\"" );
}
function VirtualMachineEvent_OnHeartbeatStopped()
{
    LogEcho( "VirtualMachine_OnHeartbeatStopped: " + strVMName );
}
function VirtualMachineEvent_OnRequestShutdown()
{
    LogEcho( "VirtualMachine_OnRequestShutdown: " + strVMName );
    //
    // return true/false to reboot
    //
    return false;
}
function VirtualMachineEvent_OnReset()
{
    LogEcho( "VirtualMachine_OnReset: " + strVMName );
}
function VirtualMachineEvent_OnStateChange( e )
{
    LogEcho( "VirtualMachine_OnStateChange: " + strVMName + " " +
             "changed to state " + e + "(" + VM_STATE_STRING[ e ] + ")" );
    switch ( e )
    {
        case VM_STATE_OFF:
            LogPopup( "Signaled to stop monitoring VM " + strVMName );
            fSignaled = true;

            break;
    }
}
function VirtualMachineEvent_OnTripleFault()
{
    LogEcho( "VirtualMachine_OnTripleFault: " + strVMName );
}

function VirtualDVDEvent_OnMediaInsert( e )
{
    LogEcho( "VirtualDVDEvent_OnMediaInsert: " + strVMName + " " +
             "DVD is bound to " + e );
}
function VirtualDVDEvent_OnMediaEject( e )
{
    LogEcho( "VirtualDVDEvent_OnMediaEject: " + strVMName + " " +
             "DVD is not bound to " + e );
}&lt;/PRE&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=650686" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/david.wang/archive/tags/Sample+Code/default.aspx">Sample Code</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Virtual+Server/default.aspx">Virtual Server</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Your+Questions/default.aspx">Your Questions</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Tips/default.aspx">Tips</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/HOWTO_2E002E002E00_/default.aspx">HOWTO...</category></item><item><title>Deploying and Updating Virtual Machines</title><link>http://blogs.msdn.com/david.wang/archive/2006/06/27/Deploying-and-Updating-Virtual-Machines.aspx</link><pubDate>Tue, 27 Jun 2006 14:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:648328</guid><dc:creator>Anonymous</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/david.wang/comments/648328.aspx</comments><wfw:commentRss>http://blogs.msdn.com/david.wang/commentrss.aspx?PostID=648328</wfw:commentRss><wfw:comment>http://blogs.msdn.com/david.wang/rsscomments.aspx?PostID=648328</wfw:comment><description>&lt;P&gt;The following are some of the more frequently asked questions when it comes to deploying a group Virtual Machines sharing common configuration.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;After updating the VHD and VMC, how to re-deploy the changes out to the group of physical machines 
&lt;LI&gt;After deploying the duplicate VHD and VMC, how to make the Windows OS in each Virtual Machine have unique name, SID, and MIC address 
&lt;LI&gt;After deploying, how to lock down the virtual and physical machine to prevent tampering 
&lt;LI&gt;And do all this with as much automation as possible... &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Well, here are my thoughts...&lt;/P&gt;
&lt;H3&gt;Question:&lt;/H3&gt;&lt;FONT face="courier new" color=#008000&gt;
&lt;P&gt;I'm considering the use of Virtual PC in a school environment. The idea is that I'll be gradually adding software and configuration options to one machine and, after making and testing each addition, copying the virtual machine to each of the other PCs.&lt;/P&gt;
&lt;P&gt;In addition to being able to access software and resources bundled with the virtual machine, each machine should be able to access resources stored on a server. A domain login is not required at this stage.&lt;/P&gt;
&lt;P&gt;There is no requirement that any changes made by students be saved.&lt;/P&gt;
&lt;P&gt;As to the ongoing management and updating of the system I am hoping to be able to copy the new image to the hosts after hours using a batch file.&lt;/P&gt;
&lt;P&gt;I have already learnt from various sources that the requirements for this configuration will be that each virtual machine must have a unique name, unique SID and unique mac address. Therefore I would like to find the most efficient way of changing these automatically, on the fly. Is there a utility which I could call from a batch file which would update these details for each instance? Ideally I would like to develop a single batch file which would update all the machines&lt;/P&gt;
&lt;P&gt;Another issue is that, when the student sits at the computer, I need as much lockdown as possible, preferably preventing them from shutting down, or modifying the configuration of the virtual machine. Is there a way of doing this?&lt;/P&gt;
&lt;P&gt;Further complicating matters I would like to close the virtual machine down automatically after hours so that any updating could take place.&lt;/P&gt;
&lt;P&gt;Thanks for any suggestions.&lt;/P&gt;&lt;/FONT&gt;
&lt;H3&gt;Answer:&lt;/H3&gt;
&lt;H4&gt;How to make the Windows OS in the Duplicated VMC/VHD Unique&lt;/H4&gt;
&lt;UL&gt;
&lt;LI&gt;Change SID: &lt;A href="http://www.sysinternals.com/Utilities/NewSid.html"&gt;http://www.sysinternals.com/Utilities/NewSid.html&lt;/A&gt; 
&lt;LI&gt;Change ComputerName: &lt;A href="http://download.microsoft.com/download/8/7/6/876af3ca-070a-4846-9b19-bd0389b575fa/Virtual%20PC%202004%20Deployment.doc"&gt;http://download.microsoft.com/download/8/7/6/876af3ca-070a-4846-9b19-bd0389b575fa/Virtual%20PC%202004%20Deployment.doc&lt;/A&gt; 
&lt;LI&gt;Change MAC address: Modify the VMC file and change the &amp;lt;ethernet_card_address&amp;gt; element&lt;/LI&gt;&lt;/UL&gt;
&lt;H4&gt;How to Lockdown the Environment&lt;/H4&gt;
&lt;P&gt;I suggest locking down both:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;the Guest OS - Group Policy or 3rd party software - your pick 
&lt;LI&gt;the VPC host - &lt;A href="http://blogs.msdn.com/virtual_pc_guy/archive/2005/08/03/447572.aspx"&gt;http://blogs.msdn.com/virtual_pc_guy/archive/2005/08/03/447572.aspx&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;UL&gt;&lt;/UL&gt;
&lt;H4&gt;How to re-deploy Changes:&lt;/H4&gt;
&lt;P&gt;Closing VM after-hours to propagate changes is trivial to do with Virtual Server since it has a scriptable automation interface. See &lt;A href="http://blogs.msdn.com/david.wang/archive/2005/10/18/HOWTO_Remotely_start_and_stop_a_Virtual_Machine_on_Virtual_Server_2005.aspx"&gt;this blog entry&lt;/A&gt; for code on how to remotely stop/start a VM&amp;nbsp; for the purposes of backing up the VHD (you would deploy the new VHD instead of backing up the existing VHD). Virtual PC does not have such provisions since it is meant for interactive and NOT automated use - see &lt;A href="http://blogs.msdn.com/david.wang/archive/2005/07/22/Why_Virtual_PC_vs_Virtual_Server.aspx"&gt;this blog entry&lt;/A&gt;&amp;nbsp;for details.&lt;/P&gt;
&lt;H4&gt;My Observations&lt;/H4&gt;
&lt;P&gt;In terms of making each duplicate VHD/VMC unique, the main challenge is to automatically launch the Change SID and Change Computer Name commands INSIDE the Guest OS when you only have control outside. This is easy to do with Virtual Server's scriptable automation interface, to pass in keystrokes, etc from the outside in.&lt;/P&gt;
&lt;P&gt;Personally, I would run Virtual Server 2005 R2 instead of Virtual PC 2004. It's &lt;A href="http://blogs.msdn.com/david.wang/archive/2006/04/06/Virtual_Server_2005_R2_is_Free.aspx"&gt;completely free&lt;/A&gt;, has the scriptable automation interface to do everything you ask for and more, and though I don't know of a lockdown switch, its UI is pretty spartan and locked down already. You simply have more options with VS2005R2, even if you may have to program some of them. It all depends on if you are ok with "not possible with VPC 2004" or "requires programming with VS2005R2"...&lt;/P&gt;
&lt;P&gt;//David&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=648328" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/david.wang/archive/tags/Virtual+Server/default.aspx">Virtual Server</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Your+Questions/default.aspx">Your Questions</category></item><item><title>HOWTO: Perform VHD Maintenance Automatically</title><link>http://blogs.msdn.com/david.wang/archive/2006/04/17/HOWTO-Perform-VHD-Maintenance-Automatically.aspx</link><pubDate>Tue, 18 Apr 2006 09:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:578130</guid><dc:creator>Anonymous</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/david.wang/comments/578130.aspx</comments><wfw:commentRss>http://blogs.msdn.com/david.wang/commentrss.aspx?PostID=578130</wfw:commentRss><wfw:comment>http://blogs.msdn.com/david.wang/rsscomments.aspx?PostID=578130</wfw:comment><description>&lt;H3&gt;Question:&lt;/H3&gt;&lt;FONT face="courier new" color=#008000&gt;
&lt;P&gt;I would like to have a night script to run on guest machines and perform the following tasks:&lt;/P&gt;
&lt;P&gt;1. start / restore from saved state if machine is not running (preferably disconnected from network in order to preserve resources)&lt;BR&gt;2. run on the guest the VHD maintenance utility (manually done by mounting the ISO from the virtual server directory and pressing next on the guest)&lt;BR&gt;3. save state / ( shut down only if necessary for next stage)&lt;BR&gt;4. compact the VHD&lt;/P&gt;
&lt;P&gt;can these tasks be done without human intervention?&lt;BR&gt;has anybody done something like that before?&lt;/P&gt;
&lt;P&gt;TIA&lt;/P&gt;&lt;/FONT&gt;
&lt;H3&gt;Answer:&lt;/H3&gt;
&lt;P&gt;I presume that you know how to schedule scripts with the proper credentials to run at the desired time, so all you need is the Virtual Server automation script which does the logical task of performing VHD maintenance.&lt;/P&gt;
&lt;P&gt;Here is a quick and dirty script that illustrates how to do this task. It does 95% of the necessary work - what it does not do (and it is clearly marked) are:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Wait for a good time to insert the ISO into the Guest 
&lt;LI&gt;Wait for when the ISO finishes running&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;These two tasks are basic interactivity with the Guest that is highly specific to your situation. There are a couple of approaches that I know of, but you get the joy to figure out which applies best to your situation.&lt;/P&gt;
&lt;P&gt;Sample Output:&lt;/P&gt;&lt;FONT color=#008000&gt;&lt;PRE&gt;Selected Virtual Machine "test" on server localhost
VM is NOT already running.
Starting VM...
Choosing Virtual DVD drive to insert precompact ISO.
Ejecting existing virtual media (Drive) Q:
****** TODO - Code to wait to start task in VM ******
Attaching to ISO image file D:\Program Files\Microsoft Virtual Server\Virtual M
chine Additions\Precompact.iso
****** TODO - Code to wait for task to finish in VM ******
Reattaching Q
Save VM State prior to Compacting.
Saving VM...
Compacting VHDs.
Compacting D:\Images\TestHD0.vhd
Compacting D:\Images\TestHD1.vhd
Done!&lt;/PRE&gt;&lt;/FONT&gt;
&lt;P&gt;Enjoy.&lt;/P&gt;
&lt;P&gt;//David&lt;/P&gt;&lt;FONT color=#008000&gt;&lt;PRE&gt;var ERROR_FILE_NOT_FOUND    = 2;
var ERROR_INVALID_PARAMETER = 87;

var GUEST_OS_SLEEP_RESOLUTION = 250;
var CLEAR_LINE = String.fromCharCode( 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 );
var CRLF = "\r\n";

var VM_STATE_OFF            = 1;
var VM_STATE_SAVED          = 2;
var VM_STATE_RUNNING        = 5;
var VM_STATE_PAUSED         = 6;

var VMDVDDrive_None         = 0;
var VMDVDDrive_Image        = 1;
var VMDVDDrive_HostDrive    = 2;

var strServer               = "localhost";
var strVMName               = "test";
var strISO                  = "D:\\Program Files\\Microsoft Virtual Server\\" +
                              "Virtual Machine Additions\\Precompact.iso";

var Fso     = new ActiveXObject( "Scripting.FileSystemObject" );
var objVS   = new ActiveXObject( "VirtualServer.Application", strServer );
var objVM   = objVS.FindVirtualMachine( strVMName );
var task;

//
// Locate the named Virtual Machine
// If it is not found, bail.
//
if ( null == objVM )
{
    LogEcho( "Virtual Machine " + "\"" + strVMName + "\"" +
             " was not found on server " + strServer );
    Quit( ERROR_FILE_NOT_FOUND );
}

LogEcho( "Selected Virtual Machine " + "\"" + strVMName + "\"" +
         " on server " + strServer );

//
// Virtual Machine is not running. Start/resume it
//
if ( objVM.State != VM_STATE_RUNNING )
{
    LogEcho( "VM is NOT already running." );

    if ( objVM.State == VM_STATE_OFF ||
         objVM.State == VM_STATE_SAVED )
    {
        LogEcho( "Starting VM..." );
        task = objVM.Startup();
        WaitForTask( task );
    }
    else if ( objVM.State == VM_STATE_PAUSED )
    {
        LogEcho( "Resuming VM..." );
        task = objVM.Resume();
    }
    else
    {
        LogEcho( "Unexpected VM State: " + objVM.State );
        Quit( ERROR_INVALID_PARAMETER );
    }
}
else
{
    LogEcho( "VM is already running." );
}

//
// Mount the ISO and assume it auto-runs
// TODO: You need to determine when the process starts and completes
//
var enumDVDDrives = new Enumerator( objVM.DVDROMDrives );
var objDVDDrive;
var strOriginalISO;
var strOriginalDrive;

if ( enumDVDDrives.atEnd() )
{
    LogEcho( "VM does not have Virtual DVD drive." );
    LogEcho( "Saving VM..." );
    task = objVM.Save();
    WaitForTask( task );
    Quit( ERROR_INVALID_PARAMETER );
}

for ( ; !enumDVDDrives.atEnd(); enumDVDDrives.moveNext() )
{
    LogEcho( "Choosing Virtual DVD drive to insert precompact ISO." );
    objDVDDrive = enumDVDDrives.item();

    //
    // Get ready to attach the ISO. But if the Guest
    // already has an ISO attached, or if the Guest
    // is capturing a Host drive letter, remember
    // that so we can restore it on completion
    //
    try
    {
        switch ( objDVDDrive.Attachment )
        {
            case VMDVDDrive_None:
                break;
            case VMDVDDrive_Image:
                strOriginalISO = objDVDDrive.ImageFile;
                LogEcho( "Ejecting existing virtual media (ISO image) " +
                         strOriginalISO );
                objDVDDrive.ReleaseImage();
                break;
            case VMDVDDrive_HostDrive:
                strOriginalDrive = objDVDDrive.HostDriveLetter;
                LogEcho( "Ejecting existing virtual media (Drive) " +
                         strOriginalDrive + ":" );
                objDVDDrive.ReleaseHostDrive();
            break;
        }

        //
        // TODO: Figure out a good time to start the task in the VM
        //
        LogEcho( "***** TODO - Code to wait to start task in VM *****" );

        LogEcho( "Attaching to ISO image file " + strISO );
        objDVDDrive.AttachImage( Fso.GetAbsolutePathName( strISO ) );

        //
        // TODO: Wait for the task to finish inside the VM
        //
        LogEcho( "***** TODO - Code to wait for task to finish in VM *****" );
    }
    catch ( e )
    {
        LogEcho( FormatErrorString( e ) );
    }

    try
    {
        if ( strOriginalISO != null )
        {
            LogEcho( "Reattaching " + strOriginalISO );
            objDVDDrive.ReleaseImage();
            objDVDDrive.AttachImage( Fso.GetAbsolutePathName( strOriginalISO ) );
        }
        else if ( strOriginalDrive != null )
        {
            LogEcho( "Reattaching " + strOriginalDrive );
            objDVDDrive.ReleaseImage();
            objDVDDrive.AttachHostDrive( strOriginalDrive );
        }
        else
        {
            LogEcho( "Releasing attached ISO image" );
            objDVDDrive.ReleaseImage();
        }
    }
    catch ( e )
    {
        LogEcho( FormatErrorString( e ) );
    }

    break;
}

//
// Save State prior to compacting
//
LogEcho( "Save VM State prior to Compacting." );
LogEcho( "Saving VM..." );
task = objVM.Save();
WaitForTask( task );

//
// Compact all VHDs
//
LogEcho( "Compacting VHDs." );
var enumHardDiskConnection = new Enumerator( objVM.HardDiskConnections );
var objHardDiskConnection;
var objHardDisk;
for ( ; !enumHardDiskConnection.atEnd(); enumHardDiskConnection.moveNext() )
{
    try
    {
        objHardDiskConnection = enumHardDiskConnection.item();
        objHardDisk = objHardDiskConnection.HardDisk;

        LogEcho( "Compacting " + objHardDisk.File );
        task = objHardDisk.Compact();
        WaitForTask( task );
    }
    catch ( e )
    {
        LogEcho( FormatErrorString( e ) );
    }
}

LogEcho( "Done!" );


function Quit( errorNumber )
{
    WScript.Quit( errorNumber );
}

function LogEcho( str )
{
    WScript.Echo( str );
}

function FormatErrorString( e )
{
    return e.number + ": " + e.description;
}

function WaitForTask( task )
{
    var complete;
    var strLine = "";
    var cchLine = 0;

    while ( (complete = task.PercentCompleted) &amp;lt;= 100 )
    {
        strLine = CLEAR_LINE.substring( 0, cchLine ) + complete + "%   ";
        cchLine = strLine.length;     //this should not exceed CLEAR_LINE

        WScript.Stdout.Write( strLine );

        if ( complete &amp;gt;= 100 )
        {
            // Delete the % display so that next line is clean.
            WScript.Stdout.Write( CLEAR_LINE );
            break;
        }

        WScript.Sleep( GUEST_OS_SLEEP_RESOLUTION );
    }
}&lt;/PRE&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=578130" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/david.wang/archive/tags/Sample+Code/default.aspx">Sample Code</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Virtual+Server/default.aspx">Virtual Server</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Your+Questions/default.aspx">Your Questions</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/HOWTO_2E002E002E00_/default.aspx">HOWTO...</category></item><item><title>Virtual Server 2005 Support Messaging</title><link>http://blogs.msdn.com/david.wang/archive/2006/04/09/Virtual-Server-2005-Support-Messaging.aspx</link><pubDate>Mon, 10 Apr 2006 09:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:571298</guid><dc:creator>Anonymous</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/david.wang/comments/571298.aspx</comments><wfw:commentRss>http://blogs.msdn.com/david.wang/commentrss.aspx?PostID=571298</wfw:commentRss><wfw:comment>http://blogs.msdn.com/david.wang/rsscomments.aspx?PostID=571298</wfw:comment><description>&lt;H3&gt;Question:&lt;/H3&gt;&lt;FONT face="courier new" color=#008000&gt;
&lt;P&gt;I am curious to know what this message is about:&lt;/P&gt;
&lt;P&gt;"You should use Microsoft Windows XP Professional as a host operating system only in a non-production environment."&lt;/P&gt;
&lt;P&gt;What does the non-production environment mean and is it recommended to set up a Virtual Server for means of building a website, exchange server, etc... on XP Pro?&lt;/P&gt;
&lt;P&gt;Look forward to your response.&lt;/P&gt;&lt;/FONT&gt;
&lt;H3&gt;Answer:&lt;/H3&gt;
&lt;P&gt;I am not a legal expert nor authoritative on this issue. What follows is merely my interpretation of various statements and logical intents. You should query &lt;A href="/virtual_pc_guy/archive/2005/04/14/408231.aspx"&gt;Ben&lt;/A&gt; or your representative for concrete details.&lt;/P&gt;
&lt;P&gt;The issue is really all about product support.&lt;/P&gt;
&lt;P&gt;If you want product support from Microsoft, then you can only use the software in the supported manner. If you have problems with Virtual Server or with the supported software inside the Guest OS, you can contact Microsoft PSS for assistance.&lt;/P&gt;
&lt;P&gt;If you do not want/need product support from Microsoft, then you can configure and run whatever you want. It is just that if something breaks or does not work, you are on your own.&lt;/P&gt;
&lt;P&gt;The reason we stick to such language on support is simple - there are an INFINITE number of ways to configure/use software, we only intend for a set combination to function and can never cover the rest, so we cannot guarantee performance of something we did not intend nor test. It is similar to a product warranty - frequently, the manufacturer warrants against defects under "normal" usage but does not include normal wear and tear, user misuse, acts of Nature, etc. In other words, the manufacturer wants to cover THEIR defect and not ANY possible defect.&lt;/P&gt;
&lt;P&gt;What it means is that Windows XP, while a supported Host OS for Virtual Server, is supported only if you run it in a non-production (i.e. personal / experimental / development&amp;nbsp;use) environment. In other words, while Microsoft supports running Server products like Exchange Server (2003SP1), Windows Server, etc inside of a supported Guest OS, if you Host it on Windows XP for your company or other people, then it is not supported; if you Host the same thing on Windows Server 2003, then it is supported.&lt;/P&gt;
&lt;P&gt;The reason is quite simple - no one uses Windows XP as a supported Server in a production environment, and you cannot do it now, even though Windows XP can Host supported Servers as Guest OS using Virtual Server. We never intended nor tested Windows XP as a production Server when it was released, and we certainly do not test it now&amp;nbsp;to Host Servers as Guest OS, either. However, we will not stop you from doing it because it is technically possible and has its own benefits; we can only say we do not support it in production.&lt;/P&gt;
&lt;P&gt;So, the answer to your question is that yes, you can run servers like Exchange, IIS, SQL, etc as a Guest OS Hosted on Windows XP. However, it is simply not recommended nor supported by Microsoft if you plan on using that combination like a real Server (i.e. have &amp;gt;1 user, physical or virtual, use it).&lt;/P&gt;
&lt;P&gt;//David&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=571298" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/david.wang/archive/tags/Virtual+Server/default.aspx">Virtual Server</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Your+Questions/default.aspx">Your Questions</category></item><item><title>Virtual Server 2005 R2 is Free!</title><link>http://blogs.msdn.com/david.wang/archive/2006/04/06/Virtual-Server-2005-R2-is-Free.aspx</link><pubDate>Thu, 06 Apr 2006 12:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:569765</guid><dc:creator>Anonymous</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/david.wang/comments/569765.aspx</comments><wfw:commentRss>http://blogs.msdn.com/david.wang/commentrss.aspx?PostID=569765</wfw:commentRss><wfw:comment>http://blogs.msdn.com/david.wang/rsscomments.aspx?PostID=569765</wfw:comment><description>&lt;P&gt;Hurray... one of my favorite technologies, Virtual Server, is now freely available for download at &lt;A href="http://www.microsoft.com/windowsserversystem/virtualserver/software/default.mspx"&gt;this location&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;I suggest that everyone go grab a copy and install it. Especially if you have VMWare.&lt;/P&gt;
&lt;P&gt;... except if you are running XP Home for your "production" environment. But then again, what professional uses that SKU and expects to get their job done? It does not support Remote Desktop (a deal breaker for me), does not support Domains, and wacky simplified security that gets in my way more than anything else. I consider it no loss that Virtual Server refuses to install on XP Home, but apparently it is a deal breaker for some. To these folks - you have no idea what you are missing out by using XP Home. Run XP Pro on your laptop!&lt;/P&gt;
&lt;P&gt;Personally, I like Virtual Server because it&amp;nbsp;marries the power of Virtual Machine technology with a simple scriptable administration API... so anyone can automatically build Virtual Machines, install OSes into them, and run them... all virtually. The only flaw here is that there is that Microsoft does not provide a ADSUTIL.VBS equivalent for Virtual Server. Not publicly available yet, anyway...&lt;/P&gt;
&lt;P&gt;I will have to change that. :-) I'm going to start tossing out sample code snippets from my Virtual Machine Control Tool (basically, the ADSUTIL.VBS for Virtual Server) so that people can see how easy it is to wield and use Virtual Server. Completely scriptable, automatable, and reusable.&lt;/P&gt;
&lt;P&gt;Incidentally, this is how the IIS7 Virtual Machines get created - all automatically. I kick off a script&amp;nbsp;which runs the VMCTL tool to create a Virtual Machine and then launches another tool inside the Virtual Machine to install Windows Vista and IIS7 automatically. Then it compacts, compresses, and seals up the VHD for later usage. Yup, I love writing tools and composing them into automation to perform logical tasks. :-)&lt;/P&gt;
&lt;P&gt;//David&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=569765" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/david.wang/archive/tags/Personal/default.aspx">Personal</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Virtual+Server/default.aspx">Virtual Server</category></item><item><title>HOWTO: Install Virtual Server VM Additions Unattended</title><link>http://blogs.msdn.com/david.wang/archive/2006/03/17/HOWTO-Install-Virtual-Server-VM-Additions-Unattended.aspx</link><pubDate>Fri, 17 Mar 2006 13:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:553590</guid><dc:creator>Anonymous</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/david.wang/comments/553590.aspx</comments><wfw:commentRss>http://blogs.msdn.com/david.wang/commentrss.aspx?PostID=553590</wfw:commentRss><wfw:comment>http://blogs.msdn.com/david.wang/rsscomments.aspx?PostID=553590</wfw:comment><description>&lt;H3&gt;Question:&lt;/H3&gt;&lt;FONT face="courier new" color=#008000&gt;
&lt;P&gt;I was wondering if it is possible not to have the virtual machine additions installation eject the iso image after installing, maybe an undocumented switch.&lt;/P&gt;
&lt;P&gt;I have created a custom OS installation CD and anything to be installed after VMA will be left hanging, or if you have more files in the $OEMO$\$$ or $OEM$\$1 directories they are never copied.&lt;/P&gt;
&lt;P&gt;If there is a switch please let me know the full command line.&lt;/P&gt;
&lt;P&gt;TIA&lt;/P&gt;&lt;/FONT&gt;
&lt;H3&gt;Answer:&lt;/H3&gt;
&lt;P&gt;The switches are all standard, documented commandlines for InstallShield and MSI. I am not certain why you want undocumented switches - I hate undocumented switches from a supportability and maintenance perspective, and why do you want us to get sued? ;-)&lt;/P&gt;
&lt;P&gt;Anyways, this is the commandline that I use to automate installation of VM Additions into my Virtual Machine as a part of OS installation - all standard and documented switches:&lt;/P&gt;&lt;FONT face="courier new" color=#008000&gt;
&lt;P&gt;setup.exe /s /v"REBOOT=ReallySupress /qn"&lt;/P&gt;&lt;/FONT&gt;
&lt;UL&gt;
&lt;LI&gt;/s - InstallShield "Silent" install switch 
&lt;LI&gt;/v - InstallShield "pass arbitrary values to the internal MSI" switch 
&lt;LI&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/reboot.asp"&gt;REBOOT&lt;/A&gt; - Standard MSI switch controlling reboot behavior (no, I do not use the newer /norestart switch because I do not want to require MSI 3.0 and I want automation that works from NT4/W2K on up) 
&lt;LI&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/command_line_options.asp"&gt;/qn&lt;/A&gt; - MSI switch which pops up NO user interactive dialog (can use /qb- to get a dialog with cancel button)&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;As for how I deal with the CD eject problem - I copy the VM Additions CD image to the local disk (or make it available on a remote UNC share) and then launch the VM Additions setup.exe in automation from the respective&amp;nbsp;locations.&lt;/P&gt;
&lt;P&gt;Honestly, the VM Additions ISO which ships is very hostile towards automation. I've filed bugs on these things before:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;AutoRun.inf launches setup normally as "setup.exe" and not unattend, so it requires clicking "Next" to install VM Additions 
&lt;LI&gt;At end of VM Additions installation, the VM DVD ejects, causing automation to hang waiting for the now-ejected ISO. 
&lt;LI&gt;IVMGuestOS.InstallAdditions() loads the ISO, but since AutoRun.inf is not unattend, this API call is useless from automation perspective&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;As a result, the first thing I do with a new Virtual Server 2005 build is to:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Take the released VM Additions ISO and extract it 
&lt;LI&gt;Perform my "fixes" to the above problems so that VM Additions installation is truly unattend 
&lt;LI&gt;Repackage my fixes into a new VM Additions ISO and have all my Virtual Server automation consume that instead&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Sorry Ben... probably not what you want to see people do, but I have to get things automated... :-/&lt;/P&gt;
&lt;P&gt;//David&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=553590" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/david.wang/archive/tags/Virtual+Server/default.aspx">Virtual Server</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Your+Questions/default.aspx">Your Questions</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/HOWTO_2E002E002E00_/default.aspx">HOWTO...</category></item><item><title>Does Virtual Server support multiple Floppy and CDROM drives?</title><link>http://blogs.msdn.com/david.wang/archive/2006/01/28/Does-Virtual-Server-support-multiple-Floppy-and-CDROM-drives.aspx</link><pubDate>Sat, 28 Jan 2006 12:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:518662</guid><dc:creator>Anonymous</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/david.wang/comments/518662.aspx</comments><wfw:commentRss>http://blogs.msdn.com/david.wang/commentrss.aspx?PostID=518662</wfw:commentRss><wfw:comment>http://blogs.msdn.com/david.wang/rsscomments.aspx?PostID=518662</wfw:comment><description>&lt;H3&gt;Question:&lt;/H3&gt;&lt;FONT face="courier new" color=#008000&gt;
&lt;P&gt;on a VM, is it possible to have simultaneously 2 CDROM, 2 Floppy drives, real or virtual?&lt;/P&gt;
&lt;P&gt;I have been told that is not possible under virtual PC 2004, but what about VS?&lt;/P&gt;&lt;/FONT&gt;
&lt;H3&gt;Answer:&lt;/H3&gt;
&lt;P&gt;You can programmatically attach multiple virtual DVD ROM drives on IDE or&amp;nbsp;SCSI bus. The virtual DVD ROM drives can be tied to physical drives or ISO&amp;nbsp;files.&lt;/P&gt;
&lt;P&gt;You cannot programmatically attach a second virtual floppy drive. The&amp;nbsp;virtual floppy drive can be tied to physical drive letter or VFD file.&lt;/P&gt;
&lt;H4&gt;Reply:&lt;/H4&gt;&lt;FONT face="courier new" color=#008000&gt;
&lt;P&gt;thank you.&lt;/P&gt;
&lt;P&gt;I was hoping I can attach ISO via ini/vmc files or without programming..&lt;/P&gt;
&lt;P&gt;Too bad&lt;/P&gt;
&lt;P&gt;BTW: what happens if an vm is restored from an image of an physical PC with 2 floppy and multiple CD/DVD drives?&lt;/P&gt;
&lt;P&gt;What if the host supports two floppy drives and 1 DVD and CD drive?&lt;/P&gt;&lt;/FONT&gt;
&lt;H4&gt;My Reply:&lt;/H4&gt;
&lt;P&gt;Actually, I do not see why you hope to be able to attach ISO via INI/VMC files and see that as "not programming"... because modifying INI/VMC files require "programming" to do the search/modification, no matter the tool that you use. And between that choice and a commandline tool that can use the Virtual Server Administration API to manipulate VirtualMachine state, I see modification of INI/VMC file to be a fragile, *nix "parse and pray" sort of approach. Sorry... but I do not miss it one bit. ;-)&lt;/P&gt;
&lt;P&gt;Regarding your interesting questions about what happens when the host supports hardware type or quantity not matched by VirtualMachine or if software image taken from a machine with different specifications than the VirtualMachine is restored...&lt;/P&gt;
&lt;P&gt;No one said that VirtualMachine represents all possible PC hardware combinations. In fact, according to documentation, Virtual Server emulates very specific types of hardware... for the purposes of running software, not to emulate arbitrary hardware.. For example:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;When the Host has the latest ATI video card that supports TV Tuner, advanced 3D graphics,&amp;nbsp;etc - the GuestOS in the VirtualMachine&amp;nbsp;only sees a S3 Video card with no TV Tuner, no advanced 3D graphics, etc. 
&lt;LI&gt;When the Host has a CDROM drive - the GuestOS still sees a virtual DVD drive and you can attach a real DVD ISO, but you obviously cannot connect the physical CDROM drive to the virtual DVD and then make the physical CDROM drive read a DVD disc even if the GuestOS thinks it is a virtual DVD drive. The GuestOS's virtual DVD drive behaves like the attached physical CDROM drive.&lt;BR&gt;&lt;BR&gt;In short, your virtual DVD drive performs like the physical CDROM&amp;nbsp;drive; only difference is that the GuestOS thinks it is a DVD drive when it is not. This is no big deal. Consider that GuestOS thinks its network card is always 100MBit even if the physical one is 10MBit or 1000MBit, but you still get the actual performance of the physical hardware.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;So, it does not matter if the host supports two floppy drives. The VirtualMachine only has one - just like the Host supports video with advanced 3D graphics but the VirtualMachine does not. Host can have features not available in the&amp;nbsp;Guest.&lt;/P&gt;
&lt;P&gt;And if the host has a CDROM and DVD drive, the Virtual Machine can be configured to see two virtual DVD drives, but one performs like a CDROM and the other the DVD. This is no big deal because we already know that Virtual Server&amp;nbsp;emulates specific hardware types for the purposes of running software. In other words, this arrangement fails for the case where the intent is to detect a virtual CDROM drive, not a virtual DVD drive performing like a CDROM, but I hope you agree that this scenario is basically contrived and unsupported.&lt;/P&gt;
&lt;P&gt;Likewise, the restoration of an image of a physical PC with two floppies is also not interesting. You are restoring a software image into a VirtualMachine of a given configuration that is different than the original. This is no different than if you imaged on one PC and then restored it to a completely different PC. Once again, Virtual Server is not in the business to emulate arbitrary hardware for detection, so this is OK.&lt;/P&gt;
&lt;P&gt;//David&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=518662" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/david.wang/archive/tags/Virtual+Server/default.aspx">Virtual Server</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Your+Questions/default.aspx">Your Questions</category></item><item><title>IIS and Virtual Server Conversations Part 2</title><link>http://blogs.msdn.com/david.wang/archive/2005/12/24/IIS-and-Virtual-Server-Conversations-Part-2.aspx</link><pubDate>Sat, 24 Dec 2005 12:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:507218</guid><dc:creator>Anonymous</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/david.wang/comments/507218.aspx</comments><wfw:commentRss>http://blogs.msdn.com/david.wang/commentrss.aspx?PostID=507218</wfw:commentRss><wfw:comment>http://blogs.msdn.com/david.wang/rsscomments.aspx?PostID=507218</wfw:comment><description>&lt;H3&gt;Question:&lt;/H3&gt;&lt;FONT face="courier new" color=#008000&gt;
&lt;P&gt;I am a 'nuts&amp;amp;bolts' guy - I need to know what kind of nuts and bolts to use for what kind of job, I don't need to know about the philosophy of why the nuts are having their threads inverted. Nuts and bolts have a practical use. I just want to learn about the practical uses to apply to IIS, and I believe you have provided me with a reasonable starting-point. If it is not all collected in one place, that cannot throw me.&lt;/P&gt;
&lt;P&gt;At the moment, I am filing on a kind of skeleton home-page, if it comes out alright, even vaguely so, I am considering enhancing the concept, I am not contemplating doing any .ASP (probably a misjudgement) but am fond of the concept of dynamically generated HTML &amp;amp; CSS - so, would it be in order to say that the depths that I will need to take myself, initially, regarding IIS revolves around learning how to configure 'what' depending on the 'what' - if you get my drift? And the smartest thing to do would be to learn how to script the configuration? It would be nice if I could find my focus rather quickly, and the technicalities of that would seem to be within my immidiate reach.&lt;/P&gt;&lt;/FONT&gt;
&lt;H3&gt;Answer:&lt;/H3&gt;
&lt;P&gt;The concept of dynamically generating HTML and CSS ties into my "blitz course" description in &lt;a href="http://blogs.msdn.com/david.wang/archive/2005/12/24/IIS_and_Virtual_Server_Conversations.aspx"&gt;this blog entry&lt;/A&gt;&amp;nbsp;in the following way. Where I said "launch the handler to generate a response", you now assume that the handler is a piece of code which takes as input a "script" which tells it how to intermingle dynamic logic with HTTP response output to generate a response.&lt;/P&gt;
&lt;P&gt;In other words, you want to look into technologies like ASP and ASP.Net because they are technologies which provide such a handler to IIS that takes as input some form of "script" which combined with framework logic of the respective ASP/ASP.Net technology, result in dynamic generation of HTTP response output. IIS is merely the platform technology upon which these framework technologies layer their user-designed logic to allow users to easily configure and build dynamic web pages.&lt;/P&gt;
&lt;P&gt;So, when you make a request to &lt;A href="http://localhost/MyPage.aspx"&gt;http://localhost/MyPage.aspx&lt;/A&gt; , what the selecation of the handler is described in this blog entry:&lt;BR&gt;&lt;a href="http://blogs.msdn.com/david.wang/archive/2005/10/14/HOWTO_IIS_6_Request_Processing_Basics_Part_1.aspx"&gt;http://blogs.msdn.com/david.wang/archive/2005/10/14/HOWTO_IIS_6_Request_Processing_Basics_Part_1.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Basically, IIS determines that the request is to an .aspx page, which is handled by the ASP.Net ISAPI Handler. So, after it does a URL-to-Filesystem mapping of /MyPage.aspx to something like C:\inetpub\wwwroot\MyPage.aspx, it invokes the ASP.Net ISAPI handler telling it to process C:\inetpub\wwwroot\MyPage.aspx . At this point, ASP.Net ISAPI Handler reads the MyPage.aspx file, which contains code similar to:&lt;/P&gt;&lt;PRE&gt;&amp;lt;%
Response.Write( "Hello World" );
%&amp;gt;&lt;/PRE&gt;
&lt;P&gt;And the handler dynamically parses/compiles the code to something that ultimately generates "Hello World" written as HTTP Response back to IIS.&lt;/P&gt;
&lt;P&gt;In other words, the problem of dynamically generating HTML pages is transformed into scripting the manipulation of a technology framework such as ASP or ASP.Net to accomplish the same task on IIS. At this point, your questions revolve around learning, configuring, and using a framework like ASP or ASP.Net... which incidentally is no longer an IIS question. :-)&lt;/P&gt;
&lt;P&gt;//David&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=507218" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/david.wang/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Virtual+Server/default.aspx">Virtual Server</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Your+Questions/default.aspx">Your Questions</category></item><item><title>IIS and Virtual Server Conversations</title><link>http://blogs.msdn.com/david.wang/archive/2005/12/24/IIS-and-Virtual-Server-Conversations.aspx</link><pubDate>Sat, 24 Dec 2005 11:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:506825</guid><dc:creator>Anonymous</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/david.wang/comments/506825.aspx</comments><wfw:commentRss>http://blogs.msdn.com/david.wang/commentrss.aspx?PostID=506825</wfw:commentRss><wfw:comment>http://blogs.msdn.com/david.wang/rsscomments.aspx?PostID=506825</wfw:comment><description>&lt;H3&gt;Question:&lt;/H3&gt;&lt;FONT face="courier new" color=#008000&gt;
&lt;P&gt;In preparation to installing Virtual Server, and acknowledging the fact that it needs IIS, I would like to know:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Is there any specific setup to perform on the IIS before I configure VS? Or, will it just need to be there?&lt;BR&gt;&lt;BR&gt;Also, since now I have web server software installed, I would like to configure it to make use of CGI (Perl!) and I am studying a description to do that right now - it mentions creating a directory where I can store the scripts AND a virtual directory under the IIS that points to this directory - now, this substitution of one directory for another was something that you could do in DOS, as I recall, so: 
&lt;LI&gt;Is this 'virtual directory' stuff something that is specific to IIS? Because the Windows filesystem wouldn't understand such a 'critter'.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;TIA&lt;/P&gt;&lt;/FONT&gt;
&lt;H3&gt;Answer:&lt;/H3&gt;
&lt;OL&gt;
&lt;LI&gt;You just need to make sure IIS is installed prior to install Virtual Server 2005 R2. This allows you to install the Admin Website component of Virtual Server, whose setup takes care of everything else 
&lt;LI&gt;"Virtual Directory" stuff is specific to IIS.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;IIS stores the Virtual-to-FileSystem mapping inside of its configuration file, and whenever it receives a HTTP request for a URL in the Virtual namespace, IIS translates it to a resource in the FileSystem namespace using its configuration.&lt;/P&gt;
&lt;P&gt;At this point, you can have any other mapping in effect in the FileSystem namespace (for example, NTFS junction points) to do further name mapping, but we are getting a bit more complicated now...&lt;/P&gt;
&lt;P&gt;FYI: Virtual Server does not need IIS to administer/function. I use Virtual Server all the time without IIS. See this blog entry:&lt;BR&gt;&lt;a href="http://blogs.msdn.com/david.wang/archive/2005/06/21/Virtual_Server_2005_Administration_on_IIS.aspx"&gt;http://blogs.msdn.com/david.wang/archive/2005/06/21/Virtual_Server_2005_Administration_on_IIS.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;//David&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=506825" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/david.wang/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Virtual+Server/default.aspx">Virtual Server</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Your+Questions/default.aspx">Your Questions</category></item><item><title>HOWTO: Pose Answerable Questions, My Top 10...</title><link>http://blogs.msdn.com/david.wang/archive/2005/10/27/HOWTO-Pose-Answerable-Questions-My-Top-10.aspx</link><pubDate>Thu, 27 Oct 2005 10:30:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:484114</guid><dc:creator>Anonymous</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/david.wang/comments/484114.aspx</comments><wfw:commentRss>http://blogs.msdn.com/david.wang/commentrss.aspx?PostID=484114</wfw:commentRss><wfw:comment>http://blogs.msdn.com/david.wang/rsscomments.aspx?PostID=484114</wfw:comment><description>&lt;p&gt;Today, I decided to do a sweep through my backlog of private blog comments which I have not yet composed a response to. There are about 120 comments going back six months in this state.&lt;/p&gt;
&lt;p&gt;Honestly, it is getting progressively harder for me to blog regularly about topics that I am interested in, maintain a good, responsive loop on the blog feedback, and still answer all the questions via blog comments. So, I am going to start a new "rule" about the comments that I will actually respond to.&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;"You get what you put in."&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;To kickstart this effort, I will demonstrate some of the more amusing private blog comments that I unfortunately have to discard from my answer queue into oblivion. I simply do not have the bandwidth to hand-hold everyone without your help. Please see &lt;a href="/david.wang/archive/2005/07/21/HOWTO_Help_Me_Help_You.aspx"&gt;this blog entry&lt;/a&gt; for more details&lt;/p&gt;
&lt;p&gt;The majority of readers that ask questions have done so very nicely with lots of details, and I thank you for your continued patience. You need only monitor the "Web Q&amp;amp;A" RSS feed and the answer will be showing up there at some point.&lt;/p&gt;
&lt;p&gt;Now, onto my Top 10 Unanswerable Blog Comments...&lt;/p&gt;
&lt;h3&gt;#10&lt;/h3&gt;&lt;font face="courier new" color=#008000&gt;
&lt;p&gt;HTTP Error 401.1 - Unauthorized: Access is denied due to invalid credentials.&lt;/p&gt;
&lt;p&gt;Internet Information Services (IIS)&lt;/p&gt;
&lt;p&gt;On a virtual directory under a web site - When I uncheck Integrated Windows Authenticatinon, I get this error. I am on Windows 2003 IIS 6 withOUT windows 2003 SP1.&lt;/p&gt;
&lt;p&gt;Any ideas?&lt;/p&gt;&lt;/font&gt;
&lt;h3&gt;Answer:&lt;/h3&gt;
&lt;p&gt;I suggest reading the following blog entry about 401.1:&lt;/p&gt;
&lt;p&gt;&lt;a href="/david.wang/archive/2005/07/14/HOWTO_Diagnose_IIS_401_Access_Denied.aspx"&gt;http://blogs.msdn.com/david.wang/archive/2005/07/14/HOWTO_Diagnose_IIS_401_Access_Denied.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I can only presume that when you say "I uncheck Integrated Windows Authentication" that you also meant that you have "Anonymous Aunthentication" enabled. But, you are asking a question, so please be clear about facts like this. Because if you had no other authentication protocols enabled, you should be getting 401.2, and I would start wondering if something else is wrong.&lt;/p&gt;
&lt;p&gt;In any case, it sounds like you have the classic "Anonymous username/password is out of sync" issue, which usually happens on IIS5 to IIS6 upgrades and you turn off IIS Sub Authentication. Or you may have group policy applied to this machine that prevents the configured anonymous user from logging in. But the point is clear - IIS is always logging in some user identity to service the request, and the user identity depends on the authentication protocol selected. Thus, you need to be clear about which authentication protocol is in use, what user identity is being logged in, and then start troubleshooting there.&lt;/p&gt;
&lt;h3&gt;#9&lt;/h3&gt;&lt;font face="courier new" color=#008000&gt;
&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I am trying to move two web applications from IIS 5 where they are working well, to Windows 2003 Server Standard SP1 and IIS 6. &amp;nbsp;I have to do this from a hardware and software support standpoint, but I was expecting to get better performance (or a wrorse the same) as IIS 5.&amp;nbsp; This is clearly not the case, it is noticeably slower even with only 1 user! The web applications uses ASP, .NET and CGI.&amp;nbsp; Any idea why this would be?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;/font&gt;
&lt;h3&gt;Answer:&lt;/h3&gt;
&lt;p&gt;You changed an entire OS as well as web server, so start regression testing to figure out what is going awry. I can tell you that at an absolute level, IIS6 is far superior to IIS5 in all respects, including performance and reliability, so you want to spend time to figure out what is going awry. Whether your particular application configuration is able to take advantage of IIS6 - that is totally up to you.&lt;/p&gt;
&lt;p&gt;Based on the technology that you are using, I suspect your code is highly serialized and likely to contend over itself in the new IIS6 worker process isolation model (for example, ASP threading model changed from STA to MTA, which can have bad effects if you are using STA objects in Session state). I do not consider it a fault if IIS6 exposes a weakness in your code... it is merely a messenger identifying a problem that you can either solve or ignore at your own peril.&lt;/p&gt;
&lt;h3&gt;#8&lt;/h3&gt;&lt;font face="courier new" color=#008000&gt;
&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am very new to this webfilter concept,i am having a dll with me , i want to register that to this ISA 2000 server ,so i have used the sample vbscript code given in the sdk help,but it wasn't&amp;nbsp;properly registered when i tried the sample filter registeration its properly registered ,&lt;/p&gt;
&lt;p&gt;So please help me to rectify the problem&lt;/p&gt;&lt;/font&gt;
&lt;h3&gt;Answer:&lt;/h3&gt;
&lt;p&gt;Sorry, but I am new to the ISA Web Filter concept as well, so I really cannot comment.&lt;/p&gt;
&lt;h3&gt;#7&lt;/h3&gt;&lt;font face="courier new" color=#008000&gt;
&lt;p&gt;I am trying to run an exe on the box with IIS 6.0 and I did carry out all the steps mentioned on this blog yet no improvements. Can someone please throw some light on this.&lt;/p&gt;&lt;/font&gt;
&lt;h3&gt;Answer:&lt;/h3&gt;
&lt;p&gt;If you just carried out the steps in my blog entry about how to enable .EXE download, then it will work. You probably carried out additional steps prior to trying out my steps, and I request that you revert those steps, whatever they are. Or read the following blog entries:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="/david.wang/archive/2005/07/11/Allow_file_downloads_on_IIS_6.aspx"&gt;http://blogs.msdn.com/david.wang/archive/2005/07/11/Allow_file_downloads_on_IIS_6.aspx&lt;/a&gt; 
&lt;/li&gt;&lt;li&gt;&lt;a href="/david.wang/archive/2005/10/17/HOWTO_Allow_file_downloads_including_exe_on_IIS_6_Part_2.aspx"&gt;http://blogs.msdn.com/david.wang/archive/2005/10/17/HOWTO_Allow_file_downloads_including_exe_on_IIS_6_Part_2.aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;To run an EXE on IIS6, all you need to do are:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Ensure that the directory allows "Scripts and Executables" 
&lt;/li&gt;&lt;li&gt;The EXE is readable by the impersonated identity through authentication 
&lt;/li&gt;&lt;li&gt;The EXE is enabled in Web Service Extension&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;I have seen people mistakenly add .EXE Application Mappings which basically foul everything up (it usually prevents .EXE from both executing and downloading), and that is not exactly my fault. :-)&lt;/p&gt;
&lt;h3&gt;#6&lt;/h3&gt;&lt;font face="courier new" color=#008000&gt;
&lt;p&gt;&lt;br/&gt;Hi David,&lt;/p&gt;
&lt;p&gt;I have a Windows 2k server and I need to either create or resolve subdomains on the fly:&lt;/p&gt;
&lt;p&gt;adam.msdn.com&lt;br/&gt;david.msdn.com&lt;/p&gt;
&lt;p&gt;In the past, I have used the 404 error page to do this, but the subdomain error doesn't resolve to the same place.&amp;nbsp; Do you have any ideas?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;&lt;/font&gt;
&lt;h3&gt;Answer:&lt;/h3&gt;
&lt;p&gt;I have no idea how creating/resolving subdomains have anything to do with IIS or a 404 error page, nor what you mean by "the subdomain error doesn't resolve to the same place". Please clarify what exactly are you trying to accomplish, not how you think you want to do it.&lt;/p&gt;
&lt;h3&gt;#5&lt;/h3&gt;&lt;font face="courier new" color=#008000&gt;
&lt;p&gt;Dear David,&lt;/p&gt;
&lt;p&gt;Hi, we are using Win2k3 Premium Server, with II6, MS SQL 2000 Standard Edition, before we install the Crystal Enterprise, the software software running very smooth; after we install it, everyday mininum hang twice, but MS SQL 2000 still working fine, i wondering is it IIS 6 which cause my software work? How to configure in order the system never down?&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;&lt;/font&gt;
&lt;h3&gt;Answer:&lt;/h3&gt;
&lt;p&gt;Ummm, let's think about it for a moment. Everything was working perfectly. Then you installed Crystal Enterprise and the server starts hanging. And you are wondering if it is IIS6 that is causing the problems?&lt;/p&gt;
&lt;p&gt;Hello?!? Wake up... I have no idea how to get to that conclusion. :-)&lt;/p&gt;
&lt;p&gt;Now, I have seen many people have problems with Crystal Enterprise software on IIS6, almost all of them due to various bugs in Crystal Enterprise because it just crashes and hangs the server if you leave it alone. Maybe you are in the same bucket as them. You can use debugging tools like IIS State or DebugDiag from Microsoft to determine that for yourself:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.iisfaq.com/default.aspx?view=P197"&gt;IIS State&lt;/a&gt; 
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.adopenstatic.com/cs/blogs/ken/archive/2005/10/05/60.aspx"&gt;Debug Diag&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;#4&lt;/h3&gt;&lt;font face="courier new" color=#008000&gt;
&lt;p&gt;I saw your name in a lot of places over ther web, so i presume that you know about IIS.&lt;/p&gt;
&lt;p&gt;I´ll be very happy, if you could help me.&lt;/p&gt;
&lt;p&gt;I can´t make my IIS work with site root path...why???? I made the Virtual Directory... &lt;/p&gt;
&lt;p&gt;I am using XP Professional.&lt;/p&gt;
&lt;p&gt;Please, i don´t know more what to do.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;/font&gt;
&lt;h3&gt;Answer:&lt;/h3&gt;
&lt;p&gt;... I have absolutely nothing constructive to offer given your information. IIS on XP Pro just works after you install it; you do not need to make a virtual directory for anything - that is how our tests run and it works.&lt;/p&gt;
&lt;p&gt;Now, you can start by describing what you mean by "I can't make my IIS work" - what errors/event log/IIS web log are you seeing? What configuration changes did you make and what effect are you expecting to see?&lt;/p&gt;
&lt;h3&gt;#3&lt;/h3&gt;&lt;font face="courier new" color=#008000&gt;
&lt;p&gt;On an upgraded installation of Windows 2003 Server, my IIS crashes on bootup over and over (I get a w3wp exception over and over, in a window on my desktop), until I view/visit a website hosted by the server. This makes no sense to me. I've tried removing PHP and Perl, and it doesn't fix the problem. I'm not running any other "add-ons", so I'm totally confused.&lt;/p&gt;
&lt;p&gt;Maybe this new program will help me figure out the problem?&lt;/p&gt;&lt;/font&gt;
&lt;h3&gt;Answer:&lt;/h3&gt;
&lt;p&gt;I suggest that you first read &lt;a href="/david.wang/archive/2005/08/29/HOWTO_Understand_and_Diagnose_an_AppPool_Crash.aspx"&gt;this blog entry&lt;/a&gt; to understand and diagnose an Application Pool Crash.&lt;/p&gt;
&lt;p&gt;Then, I suggest you follow the blog entry's suggestions and configure IIS State or DebugDiag to catch the crash. Making random configuration changes like what you are doing is definitely not the way to go.&lt;/p&gt;
&lt;p&gt;Once you have a stack trace, then you can try to determine the cause of the crash... because until you determine the cause, it is really going to be confusing because bugs are not guaranteed to make sense...&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.iisfaq.com/default.aspx?view=P197"&gt;IIS State&lt;/a&gt; 
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.adopenstatic.com/cs/blogs/ken/archive/2005/10/05/60.aspx"&gt;Debug Diag&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;#2&lt;/h3&gt;&lt;font face="courier new" color=#008000&gt;
&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I had an application running on IIS 5 and Tomcat 4.1.29 without any problems. &lt;/p&gt;
&lt;p&gt;I have moved my application to IIS 6 and using the same Tomcat version, but I get an "HTTP/1.1 401 Unauthorized" error when connecting to some servlet. I know that there has been several enhancements in IIS 6 in terms of security, but I have tried different things to make it work as in IIS 5 but have not succeeded so far.&lt;/p&gt;
&lt;p&gt;Any assistance will be much appreciated.&lt;/p&gt;&lt;/font&gt;
&lt;h3&gt;Answer:&lt;/h3&gt;
&lt;p&gt;You can&amp;nbsp;start diagnosing this 401 by reading&amp;nbsp;&lt;a href="/david.wang/archive/2005/07/14/HOWTO_Diagnose_IIS_401_Access_Denied.aspx"&gt;http://blogs.msdn.com/david.wang/archive/2005/07/14/HOWTO_Diagnose_IIS_401_Access_Denied.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The key information you want to obtain from the IIS log file is whether IIS or the ISAPI Filter/Extension DLL of Tomcat redirector is causing the 401. If it is 401.1-401.3, then look at the IIS-related suggestions in the blog entry. If it is 401.4 or 401.5, then the error is coming from the Tomcat side of things.&lt;/p&gt;
&lt;p&gt;For the most part, I do not think that IIS security enhancements are blocking you. 401.1 means that you misconfigured user login, and 401.3 means that you misconfigured user ACLs on files. Both are user misconfigurations...&lt;/p&gt;
&lt;h3&gt;#1&lt;/h3&gt;&lt;font face="courier new" color=#008000&gt;
&lt;p&gt;Hi I'm having problems with Virtual server and wondered if I could ask for your help?.&amp;nbsp; I'm running VS2005 on windows 2003 but on a 2k native domain.&amp;nbsp; It all installs ok but I cannot access the admin page unless I am a domain admin :o(.&amp;nbsp; I've played around with delegation and still no joy.&amp;nbsp; Any ideas?&lt;/p&gt;&lt;/font&gt;
&lt;h3&gt;Answer:&lt;/h3&gt;
&lt;p&gt;Whenever you mention domain membership, my first thought is to evaluate any Group Policy in effect that may adversely lockdown IIS and Virtual Server. Group Policy lockdown that the user is not aware of is probably the #1 randomization and detriment to server behavior&amp;nbsp;that I see anywhere, bar none (well, the system administrators making the configuration changes come in a close second&amp;nbsp;;-) ).&lt;/p&gt;
&lt;p&gt;By default, Virtual Server 2005 Administration website is only available to the local Administrators group on the machine that Virtual Server 2005 installed on. If you want other users/groups to be able to administer that Virtual Server 2005 installation, then you need to give them permissions. Delegation is not involved unless you are trying to store the Virtual Machine files on a remote UNC share (i.e. cover the double-hop scenario).&lt;/p&gt;
&lt;p&gt;See the following blog entries for details:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="/david.wang/archive/2005/06/21/Virtual_Server_2005_Administration_on_IIS.aspx"&gt;http://blogs.msdn.com/david.wang/archive/2005/06/21/Virtual_Server_2005_Administration_on_IIS.aspx&lt;/a&gt; 
&lt;/li&gt;&lt;li&gt;&lt;a href="/david.wang/archive/2005/10/18/HOWTO_Remotely_start_and_stop_a_Virtual_Machine_on_Virtual_Server_2005.aspx"&gt;http://blogs.msdn.com/david.wang/archive/2005/10/18/HOWTO_Remotely_start_and_stop_a_Virtual_Machine_on_Virtual_Server_2005.aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;It is definitely possible to configure non-admin users,&amp;nbsp;either domain member or local user, to locally or remotely&amp;nbsp;administer a Virtual Server 2005 machine.&lt;/p&gt;
&lt;p&gt;Virtually Yours,&lt;/p&gt;
&lt;p&gt;//David&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=484114" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/david.wang/archive/tags/ISAPI/default.aspx">ISAPI</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Personal/default.aspx">Personal</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Virtual+Server/default.aspx">Virtual Server</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Your+Questions/default.aspx">Your Questions</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Tips/default.aspx">Tips</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/HOWTO_2E002E002E00_/default.aspx">HOWTO...</category></item><item><title>HOWTO: Remotely start and stop a Virtual Machine on Virtual Server 2005</title><link>http://blogs.msdn.com/david.wang/archive/2005/10/18/HOWTO-Remotely-start-and-stop-a-Virtual-Machine-on-Virtual-Server-2005.aspx</link><pubDate>Wed, 19 Oct 2005 09:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:482565</guid><dc:creator>Anonymous</dc:creator><slash:comments>31</slash:comments><comments>http://blogs.msdn.com/david.wang/comments/482565.aspx</comments><wfw:commentRss>http://blogs.msdn.com/david.wang/commentrss.aspx?PostID=482565</wfw:commentRss><wfw:comment>http://blogs.msdn.com/david.wang/rsscomments.aspx?PostID=482565</wfw:comment><description>&lt;P&gt;Here is one of the usual questions about Virtual Server - how to remotely control the Guest VM. Actually, Virtual Server 2005 Administration API is pretty rich and supports these scenarios - you just need to write a little bit of code to do so. Small price to pay for automation.&lt;/P&gt;
&lt;H3&gt;Question:&lt;/H3&gt;&lt;FONT face="courier new" color=#008000&gt;
&lt;P&gt;I would like to remotley save and turn off my guest OS once a week so I can back up all the files associated.&lt;/P&gt;
&lt;P&gt;Is it possible to have the backup server send a command to the Host OS and have it save then turn off the OS do the backup then turn the Guest OS back on?&lt;/P&gt;&lt;/FONT&gt;
&lt;H3&gt;Answer:&lt;/H3&gt;
&lt;P&gt;The Virtual Server 2005 Administration API definitely supports this. In general, if you can do it from within the web-browser based Administration interface, you can automate it via script and do everything remotely. The key here is that you must learn a tiny bit of basic scripting and a little bit about how to use Virtual Server.&lt;/P&gt;
&lt;P&gt;The documentation is included with the default Virtual Server installation at:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;"%ProgramFiles%\Microsoft Virtual Server\Documentation\Virtual Server Programmer's Guide.chm" 
&lt;LI&gt;and also available online at: &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msvs/msvs/microsoft_virtual_server_com_interface_reference.asp"&gt;Virtual Server 2005 COM Interface Documentation&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;I highly recommend that you look through product documentation to write the necessary automation that you need for your scenario&lt;/P&gt;
&lt;P&gt;Now, if you are like 99.99% of the Virtual Server user base, you probably did want to hear me say "it's possible - just write the code yourself." Instead, you probably want me to just give you free, functional code. Well, I will get to that... but first, you will have to listen to the explanation because without it, you will not get very far. I will show you enough of the basics to do what you need - if you want to make it useful for your needs, you can take initiative to finish it up. I deliberately left the "do the backup" part up to you to decide - I just show you how to get the filenames of the VHDs that you want to backup.&lt;/P&gt;
&lt;H4&gt;The Task&lt;/H4&gt;
&lt;P&gt;This task actually has two separate components:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The ability to have the script act on a remote machine 
&lt;LI&gt;The script to turn on/off a Virtual Machine by name&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Let's do the easy one first - how to enable remote administration of a Virtual server.&lt;/P&gt;
&lt;H4&gt;Enabling Remote Administration&lt;/H4&gt;
&lt;P&gt;Given a default installation of Virtual Server 2005 with some Virtual Machines, to enable remote administration you need to ensure:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Virtual Server DCOM component allows remote instantiation and activation by the remote NT user. 
&lt;OL&gt;
&lt;LI&gt;dcomcnfg 
&lt;LI&gt;Navigate to "Component Services\My Computer\DCOM Config" node 
&lt;LI&gt;Right click on "Virtual Server" package and select Properties 
&lt;LI&gt;Select the "Security" tab 
&lt;LI&gt;Click "Edit" for the "Launch and Activation Permissions" section 
&lt;LI&gt;Give "Authenticated Users" Remote Activation and Local Activation Permissions 
&lt;LI&gt;OK out of everything&lt;/LI&gt;&lt;/OL&gt;
&lt;LI&gt;The ports of the Virtual Server DCOM server&amp;nbsp;is accessible by the remote caller (i.e. Firewall is not blocking). 
&lt;OL&gt;
&lt;LI&gt;If the Host is running Windows Server 2003 SP1 or Windows XP SP2 the Windows Firewall may be already running. Or you may have some other Firewall running. In any case, you want to make sure that there is no firewall blocking access between your remote client and the Virtual Server 
&lt;LI&gt;If using Windows Firewall, you can run the following NETSH command to make sure Virtual Server DCOM server is accessible through the Windows firewall.&lt;PRE&gt;NETSH.EXE Firewall set AllowedProgram "%ProgramFiles%\Microsoft Virtual Server\vssrvc.exe" VS2005 Enable&lt;/PRE&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;LI&gt;The remote caller also has Virtual Server Core Component installed so that they can originate the DCOM call 
&lt;LI&gt;The NT user making the DCOM call is allowed access to both the Virtual Server DCOM component (what we did in step #1) AND has Execute permission in Virtual Server security (only Administrators have this right by default).&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;You can configure Virtual Server security by:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Navigating from the homepage of the VS Administration Website and choosing "Server Properties". 
&lt;LI&gt;Then selecting "Virtual Server security". 
&lt;LI&gt;Finally Adding an entry to allow the NT user at least the "Control" permission (which gives that user access to the VS Admin API) and probably also the "Modify" and "Read" properties.&lt;/LI&gt;&lt;/OL&gt;
&lt;H4&gt;JScript Code to turn On/Off a Virtual Machine&lt;/H4&gt;
&lt;P&gt;Assuming that you have Remote administration enabled, the following JScript code should be able to run on the remote computer as the NT user with privileges to both remotely activate and access the VS Admin API and remotely contact the DCOM Server of Virtual Server to start/stop a virtual machine.&lt;/P&gt;
&lt;P&gt;You are going to want to also read the following &lt;a href="http://blogs.msdn.com/david.wang/archive/2005/07/21/HOWTO_Wait_for_Asynchronous_VirtualServer_Tasks.aspx"&gt;blog entry&lt;/A&gt; for the "WaitForTask"&amp;nbsp;script routine useful for managing and waiting for various Virtual Machine operations to "finish".&lt;/P&gt;
&lt;P&gt;//David&lt;/P&gt;&lt;FONT face="courier new" color=#008000&gt;&lt;PRE&gt;//
// Remote Start/Stop a Virtual Machine
//
var CRLF = "\r\n";
var VM_STATE_OFF = 1;
var VM_STATE_RUNNING = 5;

var strServer = "VS Server"
var strVMName = "Guest VM Name"

var objVS = new ActiveXObject( "VirtualServer.Application", strServer );
var objVM = objVS.FindVirtualMachine( strVMName );
var objTask;
var enumHardDiskConnection;
var objHardDiskConnection;
var objHardDisk;
var strFileToCopyFrom;

//
// If the Virtual Machine was found
//
if ( objVM != null )
{
    WScript.Echo( "Found Virtual Machine named: " + strVMName );

    //
    // Only attempt to wait for graceful shutdown of a running VM
    //
    // This requires VM Additions to be installed in the Guest.
    //
    // I have seen it not work on occassions and the VM is just
    // "hanging" and never shuts down.
    //
    if ( objVM.State == VM_STATE_RUNNING )
    {
        try
        {
            WScript.Echo( "Gracefully shutting down VM..." );
            task = objVM.GuestOS.Shutdown();
            WaitForTask( task );
        }
        catch ( e )
        {
            //
            // Failed graceful shutdown. Just turn the power off on
            // the Guest VM
            //
            WScript.Echo( "Forcefully shutting down VM..." );
            task = objVM.TurnOff();
            WaitForTask( task );
        }
    }

    //
    // Run your backup operation on the VHDs
    //
    enumHardDiskConnection = new Enumerator( objVM.HardDiskConnections );
    for (   ;
            !enumHardDiskConnection.atEnd();
            enumHardDiskConnection.moveNext() )
    {
        objHardDiskConnection = enumHardDiskConnection.item();
        objHardDisk = objHardDiskConnection.HardDisk;
        strFileToCopyFrom = objHardDisk.File;

        WScript.Echo( "Source VHD (relative to " + strServer + "): " + CRLF +
                      strFileToCopyFrom );
    }


    //
    // Only attempt to start up the turned-off VM
    //
    if ( objVM.State == VM_STATE_OFF )
    {
        WScript.Echo( "Starting up VM..." );
        objTask = objVM.StartUp();
        WaitForTask( objTask );
    }
}
else
{
    WScript.Echo( "Did not find Virtual Machine named: " + strVMName );
}
&lt;/PRE&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=482565" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/david.wang/archive/tags/Sample+Code/default.aspx">Sample Code</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Virtual+Server/default.aspx">Virtual Server</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Your+Questions/default.aspx">Your Questions</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/HOWTO_2E002E002E00_/default.aspx">HOWTO...</category></item><item><title>Why use Virtual PC or Virtual Server?</title><link>http://blogs.msdn.com/david.wang/archive/2005/07/22/Why-Virtual-PC-vs-Virtual-Server.aspx</link><pubDate>Fri, 22 Jul 2005 17:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:441738</guid><dc:creator>Anonymous</dc:creator><slash:comments>23</slash:comments><comments>http://blogs.msdn.com/david.wang/comments/441738.aspx</comments><wfw:commentRss>http://blogs.msdn.com/david.wang/commentrss.aspx?PostID=441738</wfw:commentRss><wfw:comment>http://blogs.msdn.com/david.wang/rsscomments.aspx?PostID=441738</wfw:comment><description>&lt;P&gt;One of the popular comparisons of Virtual Machine technologies is Virtual PC vs. Virtual&amp;nbsp;Server (the other being Virtual Server vs. VMWare GSX/ESX). I decided to tackle the Virtual PC vs. Virtual Server comparison with a little brain dump.&lt;/P&gt;
&lt;P&gt;This is purely my perspective as someone who&amp;nbsp;extensively uses both&amp;nbsp;Virtual PC and Virtual Server, and I do not work on the&amp;nbsp;product team that produces either product.&lt;/P&gt;
&lt;H3&gt;Question:&lt;/H3&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#008000&gt;Hi All,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#008000&gt;I am new to this subject. Have started using Virtual PC a month back. I found it really amazing. I also tried Virtual Server, but it was a bit complicated to setup and use. Virtual PC is a breeze to setup and use. Why Virtual Server is needed, if Virtual PC is a so cool product?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#008000&gt;Thanks,&lt;/FONT&gt;&lt;/P&gt;
&lt;H3&gt;Answer:&lt;/H3&gt;
&lt;P&gt;Good question. &lt;/P&gt;
&lt;P&gt;When I think of different products using similar technology, there is usually some form of market segmentation based on user demographics.&lt;/P&gt;
&lt;P&gt;For example, Toyota brands its vehicles under both an economy Toyota brand and the luxury Lexus brand. Same basic car - has four wheels, engine, steering column, enclosed climate-controlled passenger cabin, etc. But there are enough differences in each brand that satisfies the target user audience. Toyota is general more economically priced and may not have the latest in fancy gadgets, while Lexus targets the more leisure conscious and "latest and greatest" folks.&lt;/P&gt;
&lt;P&gt;You can imagine the same sort of distinction between Virtual PC and Virtual Server given the same&amp;nbsp;"Virtual Machine" technology. While I am glad that you think Virtual PC is cool and easy to setup and use (it obviously fits your demographic and needs), I can tell you that Virtual PC is completely useless for my business needs. For me, Virtual Server ends up being the best way to use Virtual Machine technology to do what I want. But, this should not affect either of our perceptions - we are just users with different needs satisfied by different segmentation of the same sort of "Virtualization" product.&lt;/P&gt;
&lt;P&gt;For example, Virtual Server allows me to create and configure an entire Virtual Machine with a variety of options with one command line script and automate scripting these actions against an entire farm of Virtual Servers. Virtual PC cannot even come close to doing this. Meanwhile, Virtual PC has a really rich GUI and strong VM Additions support that improve interactive usability; something that Virtual Server cannot match.&lt;/P&gt;
&lt;P&gt;This is how I tend to internalize and compare&amp;nbsp;Virtual PC and Virtual Server.&lt;/P&gt;
&lt;H3&gt;Virtual PC&lt;/H3&gt;
&lt;UL&gt;
&lt;LI&gt;Rich GUI client for local interactive use. 
&lt;LI&gt;Low security/High interactivity&amp;nbsp;(Shared Folders, Drag/Drop, Cut/Paste). 
&lt;LI&gt;No Automation/Scripting Interface. 
&lt;LI&gt;Client-oriented features (Sound Card in VM). 
&lt;LI&gt;All Guests use one CPU on the host.
&lt;LI&gt;As of Virtual PC 2004, x86 only&lt;/LI&gt;&lt;/UL&gt;
&lt;H3&gt;Virtual Server&lt;/H3&gt;
&lt;UL&gt;
&lt;LI&gt;Thin web-based admin and VMRC client for remote/headless administrative use. 
&lt;LI&gt;High security/Low interactivity&amp;nbsp;(nothing "shared" between Guests and Host). 
&lt;LI&gt;Full Automation/Scripting Interface&amp;nbsp;with COM. 
&lt;LI&gt;Server-oriented features (Virtual SCSI emulation, per VM CPU throttling, VS Security model&amp;nbsp;for delegation. But no Sound Card). 
&lt;LI&gt;Guests use all CPUs on the host, but each Guest still sees and uses only one CPU.
&lt;LI&gt;As of Virtual Server 2005 R2, x86 and x64 supported&lt;/LI&gt;&lt;/UL&gt;
&lt;H3&gt;Conclusion&lt;/H3&gt;
&lt;P&gt;Virtual PC clearly targets the average interactive user with&amp;nbsp;rich functionality and features. However, it trades off security for some functionality, cannot be scripted/automated, does not run as a service so requires a user login, and cannot utilize all CPUs on the host.&amp;nbsp;On the other hand, these are all factors that Virtual Server perform well, but it also gives up on the rich, interactive user experience for a more headless, lightweight, remoteable, but limited interactive viewer.&lt;/P&gt;
&lt;P&gt;Hopefully, this helps clarify why the two products exist, some of the users/market that each targets, and why one may like one, the other, or both, depending on needs.&lt;/P&gt;
&lt;P&gt;//David&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=441738" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/david.wang/archive/tags/Virtual+Server/default.aspx">Virtual Server</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Your+Questions/default.aspx">Your Questions</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Tips/default.aspx">Tips</category></item><item><title>HOWTO: Kickoff. Wait for Asynchronous Virtual Server Task Completion</title><link>http://blogs.msdn.com/david.wang/archive/2005/07/21/HOWTO-Wait-for-Asynchronous-VirtualServer-Tasks.aspx</link><pubDate>Thu, 21 Jul 2005 17:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:407101</guid><dc:creator>Anonymous</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/david.wang/comments/407101.aspx</comments><wfw:commentRss>http://blogs.msdn.com/david.wang/commentrss.aspx?PostID=407101</wfw:commentRss><wfw:comment>http://blogs.msdn.com/david.wang/rsscomments.aspx?PostID=407101</wfw:comment><description>&lt;P&gt;Ok, lately I have been very busy with IIS7 related milestones, so I am a little drained mentally. Thus, I will talk about a "simpler" topic that should still be useful useful... just not as much prep work for me... Virtual Server. :-)&lt;/P&gt;
&lt;P&gt;This will be the first of many articles&amp;nbsp;about the Virtual Server 2005 Administration API and how to programmatically take advantage of it to do a variety of things.&lt;/P&gt;
&lt;H3&gt;Motivation&lt;/H3&gt;
&lt;P&gt;I have been an avid Virtual Server user/developer from the very beginning of the product, so I have a huge code investment in&amp;nbsp;automating a variety of tasks&amp;nbsp;within Virtual Server... and after reading the code samples from the blog of &lt;a href="http://blogs.msdn.com/Virtual_PC_Guy/"&gt;Virtual PC Guy (Ben)&lt;/A&gt;, I have decided that I should share some of the more non-obvious tidbits of how to use Virtual Server. After all, I had to figure out several of these things after being informed by various members of the Virtual Server product team how X or Y was not possible for reason Z... but I still needed to do them anyways, so I figured it out.&lt;/P&gt;
&lt;P&gt;For example, Ben's Guest keyboard typer does not work if the Guest and Host OS have different keyboard layout. Try setting the Host with the Dvorak layout and the Guest with QWERTY (or vice versa) and see what happens. Complete gibberish. I was the first to file that bug... probably&amp;nbsp;because I was the first non-QWERTY typist to use Virtual Server. Now, I can type both QWERTY and Dvorak, but I favor Dvorak because it is SO much more comfortable than QWERTY.&lt;/P&gt;
&lt;H3&gt;The First Task... Waiting&lt;/H3&gt;
&lt;P&gt;Let's start simple. A simple function which generically "waits" for any asynchronous Virtual Server task to complete while displaying live "progress" to the console window. Yes, all of my code requires the CSCRIPT&amp;nbsp;Windows Scripting Host - run the following as administrator to set up Windows Scripting host:&lt;/P&gt;&lt;PRE&gt;CSCRIPT //h:cscript //NoLogo //s&lt;/PRE&gt;
&lt;P&gt;Hey, I believe in commandline automation tools. None of that pansy&amp;nbsp;WSCRIPT stuff or mushy VB.Net/C# UI stuff... because we all know that real work gets done with commandline tools. Thems fighting words... ;-)&lt;/P&gt;
&lt;P&gt;Now, why is such a function useful? Well, various VS API calls change state within the Virtual Machine, and sometimes, you want to access useful state that is present IMMEDIATELY AFTER the task is complete. Some examples and why it is useful:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;IVirtualMachine.Save() - the task ends when the Virtual Machine is completely saved to disk. You need this when you want to automate saving Virtual Machine state prior to making a copy of the various saved VM files from the host. 
&lt;LI&gt;IVirtualMachine.MergeUndoDisks() - the task ends when the undo drive is completely committed. You need this to commit an undo drive and then possible re-start the Virtual Machine or make a copy of the merged drive file from the host. 
&lt;LI&gt;IVirtualServer.CreateFixedVirtualHardDisk() - the task ends when the fixed hard disk is completely created (if you create a multi-gigabyte fixed VHD, it can take a while). You need this if you automate creation of virtual hard disks and be assured that the virtual hard disk is "valid for use" when attached to the Virtual Machine so that you can immediately power on the VM. 
&lt;LI&gt;IVirtualHardDisk.Compact() - the task ends when the "compact" function finishes. This is useful in conjunction with other functions that automate the defrag, pre-compact, compact, and restore of a VHD to trim its size back down.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Now, I realize that I just mentioned a whole bunch of related functionality that one would love use in conjunction with this simple function. Yes, I will give code samples and explanation of them in future blog entries.&lt;/P&gt;
&lt;P&gt;Enjoy.&lt;/P&gt;
&lt;P&gt;//David&lt;/P&gt;
&lt;H3&gt;Code to Wait for VS Task&lt;/H3&gt;
&lt;P&gt;The WaitForTask() function expects an asynchronous Virtual Server Task as input, and it will output simple "percentage complete" progress text as the task is waited on, and when the task finishes, the function returns and deletes its progress text so that the rest of your automation still&amp;nbsp;gets a clean console output without the transient state of waiting for a task to complete (for logging purposes, for example).&lt;/P&gt;&lt;FONT color=#008000&gt;&lt;PRE&gt;var GUEST_OS_SLEEP_RESOLUTION = 250;
var CLEAR_LINE = String.fromCharCode( 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 );
var CRLF = "\r\n";

function WaitForTask( task )
{
    var complete;
    var strLine = "";
    var cchLine = 0;

    while ( (complete = task.PercentCompleted) &amp;lt;= 100 )
    {
        strLine = CLEAR_LINE.substring( 0, cchLine ) + complete + "%   ";
        cchLine = strLine.length;     //this should not exceed CLEAR_LINE

        WScript.Stdout.Write( strLine );

        if ( complete &amp;gt;= 100 )
        {
            // Delete the % display so that next line is clean.
            WScript.Stdout.Write( CLEAR_LINE );
            break;
        }

        WScript.Sleep( GUEST_OS_SLEEP_RESOLUTION );
    }
}
&lt;/PRE&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=407101" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/david.wang/archive/tags/Sample+Code/default.aspx">Sample Code</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Virtual+Server/default.aspx">Virtual Server</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Tips/default.aspx">Tips</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/HOWTO_2E002E002E00_/default.aspx">HOWTO...</category></item><item><title>Why do I still get a user/password Login prompt with Integrate Authentication (for Virtual server 2005 Administration website)</title><link>http://blogs.msdn.com/david.wang/archive/2005/07/04/Why-you-get-login-prompt-on-VS2005-with-Integrated-Auth.aspx</link><pubDate>Tue, 05 Jul 2005 09:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:434906</guid><dc:creator>Anonymous</dc:creator><slash:comments>30</slash:comments><comments>http://blogs.msdn.com/david.wang/comments/434906.aspx</comments><wfw:commentRss>http://blogs.msdn.com/david.wang/commentrss.aspx?PostID=434906</wfw:commentRss><wfw:comment>http://blogs.msdn.com/david.wang/rsscomments.aspx?PostID=434906</wfw:comment><description>&lt;P&gt;When Integrated Authentication is enabled, users frequently wonder why they are still prompted for username/password. After all, isn't Integrated Authentication supposed to get rid of that?&lt;/P&gt;
&lt;P&gt;Thus, the following question has come up several times when users install and use Virtual Server. While the problem looks like one with IIS or even Virtual Server somehow, it can be caused by the web browser's configuration, as described below.&lt;/P&gt;
&lt;H3&gt;Question:&lt;/H3&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#008000&gt;I have just installed virtual server and am having problems with the administrative website. The host machine is Windows Server 2003 with SP1. The virtual server administrative website is set to allow integrated windows authentication yet when I try to access the page I am prompted for a username/password. If I enter username/password I can access the site. I have granted the appropriate permissions on the site home dir.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#008000&gt;The administrative site address is:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#008000&gt;http://vsserver.north.root.domain.com:1024/VirtualServer/VSWebApp.exe?view=1&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#008000&gt;If I enter the following address integrated windows authentication works and I am granted access to the site without being prompted for a username/password:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#008000&gt;http://vsserver:1024/VirtualServer/VSWebApp.exe?view=1&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#008000&gt;The site is not using host headers.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#008000&gt;Any ideas would be appreciated&lt;/FONT&gt;&lt;/P&gt;
&lt;H3&gt;Answer:&lt;/H3&gt;
&lt;P&gt;Actually, this problem is probably caused by your web browser not auto-authenticating to the VS 2005 admin website because it treats your two URLs as belonging in different Zones. One of the Zones is configured to auto-authenticate with current logged on user credentials and the other is not.&lt;/P&gt;
&lt;P&gt;IE's default behavior is to auto-authenticate in Intranet Zone. "http://vsserver:1024" fits the pattern of an Intranet website. Meanwhile, "http://vsserver.north.root.domain.com:1024" fits the pattern of a dotted URL address, which is treated as the Internet Zone, which does not have auto-authenticate enabled.&lt;/P&gt;
&lt;P&gt;Thus, IE does not auto-authenticate when you use the dotted URL address, meaning that when IIS requests your administrator credentials to access the VS2005 admin website, you get the user login popup.&lt;/P&gt;
&lt;P&gt;To "fix" this, you either:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Change the Zone which contains the second URL&amp;nbsp;(dotted URL address) 
&lt;LI&gt;Change the auto-authenticate option of the existing Zone of the second URL&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;I suggest option #1 since you do not want the browser to auto-authenticate against arbitrary Internet websites.&lt;/P&gt;
&lt;P&gt;//David&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=434906" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/david.wang/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Virtual+Server/default.aspx">Virtual Server</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Your+Questions/default.aspx">Your Questions</category></item><item><title>Ins and Outs of Virtual Server 2005 Administration and IIS</title><link>http://blogs.msdn.com/david.wang/archive/2005/06/21/Virtual-Server-2005-Administration-on-IIS.aspx</link><pubDate>Wed, 22 Jun 2005 08:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:430107</guid><dc:creator>Anonymous</dc:creator><slash:comments>27</slash:comments><comments>http://blogs.msdn.com/david.wang/comments/430107.aspx</comments><wfw:commentRss>http://blogs.msdn.com/david.wang/commentrss.aspx?PostID=430107</wfw:commentRss><wfw:comment>http://blogs.msdn.com/david.wang/rsscomments.aspx?PostID=430107</wfw:comment><description>&lt;P&gt;A very common belief about Virtual Server 2005 administration is that it requires IIS to be installed, either on the host machine itself or on the remote admin machine.&lt;/P&gt;
&lt;P&gt;My day job has me spending lots of time testing and working with&amp;nbsp;the internals of IIS, and I am also an avid user of Virtual Server 2005 since its internal pre-release beta days. So, I decided to investigate the details of this common belief and shine some light on what is going on beneath the covers.&lt;/P&gt;
&lt;H3&gt;Bottom Line&lt;/H3&gt;
&lt;UL&gt;
&lt;LI&gt;You DO NOT need to install nor use IIS to administer Virtual Server 2005 
&lt;LI&gt;You DO NOT need to be at the Virtual Server 2005 machine to administer it 
&lt;LI&gt;You DO NOT even need to be a local system administrator to be able to administer Virtual Server 2005 or its Virtual Machines&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Yes, Virtual Server is highly flexible when it comes to administration possibilities, even if the currently shipping administration tool does not provide it. Virtual Server administration can be decentralized, delegated, and does not even require a web server for remote access. I know because I wrote a commandline tool that does this. :-)&lt;/P&gt;
&lt;H3&gt;Overview&lt;/H3&gt;
&lt;P&gt;Virtual Server introduces a COM based&amp;nbsp;Administration API that is accessible by Windows Script Host, native code, and managed code.&lt;/P&gt;
&lt;P&gt;The API exposes everything related to Virtual Server such as:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Create/Manipulate/Delete Virtual Machine (VMC files) 
&lt;LI&gt;Create/Manipulate/Delete Virtual Network (VNC files) 
&lt;LI&gt;Create/Manipulate Virtual Harddrives (VHD files) 
&lt;LI&gt;Create/Manipulate other virtual hardware/peripherals like RAM, Floppy, DVDROM, IDE/SCSI Bus, SCSI Controller, COM ports, Parallel ports 
&lt;LI&gt;Transition Virtual Machine state (start/save/pause/resume/off) 
&lt;LI&gt;Assign Virtual Server Security 
&lt;LI&gt;Lots of other miscellaneous features like CPU throttling per VM, virtual keyboard/mice, async event callbacks, etc for the type A admin&lt;/LI&gt;&lt;/UL&gt;
&lt;H3&gt;Helpful Reference&lt;/H3&gt;
&lt;P&gt;I found this great diagram inside of Virtual Server documentation (Virtual Server Technical Reference\How Virtual Server Works\Architecture\Virtual Server architecture) that gives a high-level glance at the logical pieces and connection protocols. The diagram's URL is: &lt;A href="http://www.microsoft.com/technet/prodtechnol/virtualserver/2005/proddocs/images/vs_und_01c.gif"&gt;http://www.microsoft.com/technet/prodtechnol/virtualserver/2005/proddocs/images/vs_und_01c.gif&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.microsoft.com/technet/prodtechnol/virtualserver/2005/proddocs/images/vs_und_01c.gif"&gt;&lt;/P&gt;
&lt;H3&gt;Details&lt;/H3&gt;
&lt;P&gt;Virtual Server 2005 ships with a native code EXE program named VSWebApp.exe&amp;nbsp;which calls the native COM&amp;nbsp;based API. VSWebApp.exe implements CGI/1.1 to read/parse input and provide HTML as output, so it naturally runs as a CGI executable on IIS to provide a web-based administration interface.&lt;/P&gt;
&lt;P&gt;VSWebApp.exe is very nicely abstracted into logical layers and has no IIS-specific dependencies that I could find (the IO layer is pure CGI and abstracts the underlying platform away such that higher-level parts of the CGI do not worry about HTTP concepts like reading/writing&amp;nbsp;entity body, retrieving/setting form parameters, HTML/HTTP encoding, etc).&lt;/P&gt;
&lt;P&gt;Although I have not tried, VSWebApp.exe should run unmodified as a CGI on Apache for Windows. But, as I have alluded to earlier, you do not need a web server to administer Virtual Server. So, changing web servers is merely a exercise left to the reader. We can do one better by not needing the web server at all.&lt;/P&gt;
&lt;P&gt;Virtual Server 2005 supports DCOM Remoting for its COM based API, and this support is registered within vssrvc.exe. This allows you to perform the aforementioned administration tasks against a remote Virtual Server by merely instantiating the COM object differently. In fact, VSWebApp.exe liberally uses this feature to "tunnel" and allow you to administer against a remote Virtual Server which does not have IIS installed.&lt;/P&gt;
&lt;P&gt;Virtual Server 2005 introduces a simple internal security model. At a server-wide scope, you declare allow or deny ACL for a given user identity and the specified list of privileges, which include:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Modify - gives access to add Virtual Machine and Virtual Network configuration 
&lt;LI&gt;Remove - gives accees to delete Virtual Machine and Virtual Network configuration 
&lt;LI&gt;View - gives access to read Virtual Server and Virtual Machine configuration as well as view the Virtual Machine with VMRC 
&lt;LI&gt;Change - gives ability to change these privileges in Virtual 
&lt;LI&gt;Control - gives access to the COM interface itself. You cannot administer Virtual Server without it 
&lt;LI&gt;Special - currently, I do not know what it does. It is available to be set via the administration API, but I have not found a way to make it persist.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Basically, you give "Control" access to allow someone to be able to use/administer Virtual Server, "Change" to give someone the admin bit, and the others are the usual Read/Modify/Delete permissions securing Virtual Machine&amp;nbsp;and Virtual Networks. And since Virtual Machines are just files, you can also apply NTFS ACLs on the files to get more interesting and granular combinations.&lt;/P&gt;
&lt;P&gt;For example, you can give a user "View" privileges, so they can theoretically view any Virtual Machine registered on the system... but you can set NTFS ACLs on the VMC, VNC, and VHD files such that they can only see and run certain Virtual Machines.&lt;/P&gt;
&lt;H3&gt;Conclusion&lt;/H3&gt;
&lt;P&gt;By now, what I stated earlier should be clear.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;You DO NOT need to install nor use IIS to administer Virtual Server 2005. Administration of Virtual Server requires you to manipulate its COM based API somehow, either via native code, managed code, or Windows Script Host. The product provides a&amp;nbsp;web-based administration tool by default, but it does not preclude other administration forms. For example, I know of GUI and control panels using managed code being developed. Personally, I implemented a lightweight commandline VS administration tool using Windows Script Host in about 3,000 lines of code where I can create a newly configured Virtual Machine with a single commandline and about 8 switches. 
&lt;LI&gt;You DO NOT need to be at the Virtual Server 2005 machine to administer it. Virtual Server supports DCOM remoting so that you can use the same COM based API but targetted at Virtual Server on a different machine. VSWebApp.exe also allows a HTTP-based front end (to hop across firewalls, for example) before using DCOM on that server to target another remote Virtual Server. 
&lt;LI&gt;You DO NOT even need to be a local system administrator to be able to administer Virtual Server 2005 or its Virtual Machines. You just need to give the user identity Control and View privileges in Virtual Server as well as Read/Write privileges to the NTFS filesystem where the Virtual Machine / Virtual Network is stored.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;For example, I exclusively run as non-administrator (i.e. just plain normal User) on all of my machines. I use my administrator account to install Virtual Server 2005, add my non-administrator user to Virtual Server with all privileges except Change, and then as non-administrator I can create/delete/view any Virtual Machine that my user identity has read/write access to the physical files that make up the Virtual Machine.&lt;/P&gt;
&lt;P&gt;//David&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=430107" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/david.wang/archive/tags/Virtual+Server/default.aspx">Virtual Server</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Your+Questions/default.aspx">Your Questions</category><category domain="http://blogs.msdn.com/david.wang/archive/tags/Tips/default.aspx">Tips</category></item></channel></rss>