High-level steps to SP2010 Demo VHD boot joy

Standard

This is sure to raise more questions than it answers… but here goes: how I managed to get the downloadable Information Worker Demo VM to boot straight from VHD (i.e. no host OS). This assumes a fair level of comfort and proficiency in virtual hardware environments, specifically managing virtual hard disks, the Windows registry, commands, etc. Also note that incorrectly performing some of these steps could potentially render your original host OS unbootable, so beware!!

Part I:

  1. Download and extract VHD (duh).
  2. Make sure the target computer/laptop/server is already running either Windows 2008 R2 or Windows 7. VHD booting requires the new boot loader from either OS to mount a VHD during boot.
  3. Mount the VHD in your fave x64-guest-compatible virtualization platform (other than Hyper-V, I’ve also had success with VirtualBox, others have gotten VMWare to work too after VHD conversion).
  4. Boot the demo VM as you normally would. Once up, you can optionally disable the demo services for faster boot & operation until the VHD is in its final self-booting state.
  5. Upgrade the OS of the IW Demo VM from Win2008 to Win2008 R2 – this is required for VHD boot. Note that you’ll need to run a few adprep commands first, since the demo VM is a domain controller.
  6. Modify your original (physical) boot configuration (using BCDEDIT.exe) to include the path to your newly-upgraded VHD. Sample steps for doing so can be found here and here.

If you’re still with me, at this point you’ll have a freshly-upgraded VM and VHD file, almost ready for VHD boot. Now we’ll need to make sure it actually boots (as opposed to blue-screening). You can definitely try it out now – if it works great! If not (more likely), then read on for Part II.

Part II:

  1. You’ll most likely need to download and ‘inject’ the driver for the hard disk controller for your target hardware. Why? Because apparently the OS that’s booting from the VHD needs to communicate with the hardware the same way your current OS does, and if it can’t do so during boot, it just fails. For example, for most Intel-based chipsets/controllers, you’ll need the Matrix Storage driver. Further, you’ll need to modify the registry so that the VM knows to load this driver at boot. This is probably the trickiest part of this whole process. The steps outlined here are a good starting point, of course you’ll need to modify them to include the registry entries for your own hardware… Here are some basic steps that worked for me:
    1. Download the controller driver, extract it, and copy the extracted files to both C:Windowsinf and C:Windowssystem32drivers on the VM image (I know this is overdoing it, but it works)
    2. Export the HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlCriticalDeviceDatabase on your original (host) OS subtree to a file, like reg1.reg – again, we probably don’t need the whole thing but in a rush it will get us what we need in terms of boot driver config
    3. Export the HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservices<drivername> registry subtree on the original (host) OS to reg2.reg. In my case <drivername> was iaStor for the Intel RAID Controller.
    4. Import the two exported registry file into your demo VM. Note that after doing this, you may only be able to do VHD boot going forward, and that booting again while in a VM may not work!
  2. Try (re-try) booting your VHD
  3. If it still fails, you might want to check that:
    1. You have enough free space on your host disk for the VHD to expand to its full capacity when booting (default is ~127GB for the demo VM)
    2. Your VHD isn’t on a compressed or encrypted volume
    3. You’ve actually applied the right hard disk controller driver to the VHD image (hit ‘F8’ during boot to enable troubleshooting options)

Assuming you haven’t given up by this point, and you’ve actually managed to get the VHD to boot, you can now install all the rest of the required drivers (video, LAN, peripherals etc.), just as you would for a regular OS running on the bare metal – because after all, it is running on the bare metal (except for the virtualized boot hard disk). Also, you can re-enable all of your services (if you disabled them in step 4.), but disable the Hyper-V guest services (since we’re no longer running in Hyper-V). Finally, you’ll want to apply the SharePoint 2010 pre-requisite hotfix for Win2008 R2 to your demo machine – since it was upgraded from plain Win2008, it would only have the hotfix for that particular OS applied.

Good luck!!

References:

Powershell script to enable/disable services in SP2010 Demo VM

Standard

If any of you have had the chance to play around with Microsoft’s recent public release of the Information Worker Demo VM, you’ll notice that a) it has pretty much everything thrown in in terms of the Office suite of server/client products and b) it’s a hog! At idle, the VM will start to consume almost 10GB RAM (combined physical and virtual/paging) within minutes of booting up. For developers and sysadmins used to running (2 or 3) 32-bit MOSS2007 Virtual PCs concurrently on your laptop, the new resource requirements for SP2010 can be quite a shock. How can we trim and optimize the resources the demo VM uses? By turning off services we don’t immediately need…

For example, if you want to develop/demo SharePoint 2010 stuff only, but don’t care about Office Communications Server, you can turn all of these services (and the supporting SQL instance) off, and free up quite a bit of RAM. However, you might want to change this in a different scenario, so that only the OCS services are running but the SharePoint stuff is off. This could get pretty tedious if we were simply using the Services MMC each time!

Using a Powershell script though, we can quickly enable/start or disable/stop different services on our demo VM, just in time for its intended use at any particular time. The script below can easily be further customized to allow for greater granularity over what services are controlled, etc. Consider it a starting point towards getting only the services you want running at any particular time on a machine with limited resources.

[UPDATE] – turns out Emmanuel Bergerat had already released scripts with very similar functionality, way back in November! Definitely check these out for another approach to freeing up resources on a SP2010 install.

Hope you find it useful! Oh and watch the line breaks and double quotes when copying/pasting…


## Stop-Start-Services.ps1 by Brian Lalancette
## Originally intended for SP2010 IW Demo VM

Function StopUnneededServices
{
Write-Host -ForegroundColor Blue "- Stopping services..."
#Permanent service stoppage - you likely wont need these in the demo VM
$ServicesToSetManual = ("Spooler",`
"AudioSrv",`
"TabletInputService",`
"UxSms",`
"ftpsvc",`
"MSSQLFDLauncher",`
"SQLSERVERAGENT")
$ServicesToDisable = ("WPDBusEnum",`
"WerSvc",`
"WSearch")
Write-Host -ForegroundColor Blue "- Setting some unneeded services to Manual start..."
ForEach ($SvcName in $ServicesToSetManual)
{
If (Get-Service -Name $SvcName -ErrorAction SilentlyContinue)
{
Stop-Service -Name $SvcName -Force
Set-Service -Name $SvcName -StartupType Manual
Write-Host -ForegroundColor Blue " - Service $SvcName is now set to Manual start"
}
}
Write-Host -ForegroundColor Blue "- Disabling some unneeded services..."
ForEach ($SvcName in $ServicesToDisable)
{
If (Get-Service -Name $SvcName -ErrorAction SilentlyContinue)
{
Stop-Service -Name $SvcName -Force
Set-Service -Name $SvcName -StartupType Disabled
Write-Host -ForegroundColor Blue " - Service $SvcName is now disabled."
}
}
}

Function StopSPServices
{
#Temporary SP demo service stoppage; use actual service name, not display (long) name
$ServicesToDisable = ("FASTSearchService",`
"FASTSearchMonitoring",`
"ProjectEventService14",`
"ProjectQueueService14",`
"WebAnalyticsService",`
"SPAdminV4",`
"SPTimerV4",`
"SPTraceV4",`
"SPAdminV4",`
"SPUserCodeV4",`
"OSearch14",`
"FIMService",`
"FIMSynchronizationService",`
"MSSQLSERVER",`
"MSSQLServerOLAPService",`
"MSDtsServer100",`
"ReportServer",`
"SQLWriter",`
"W3SVC",`
"IISADMIN")
Write-Host -ForegroundColor Blue "- Disabling SP demo services..."
ForEach ($SvcName in $ServicesToDisable)
{
If (Get-Service -Name $SvcName -ErrorAction SilentlyContinue)
{
Stop-Service -Name $SvcName -Force
Set-Service -Name $SvcName -StartupType Disabled
Write-Host -ForegroundColor Blue " - Service $SvcName is now disabled."
}
}
Write-Host -ForegroundColor White "- Finished disabling SP demo services."
}

Function StopFASTServices
{
#Temporary FAST service stoppage; use actual service name, not display (long) name
$ServicesToDisable = ("FASTSearchService",`
"FASTSearchMonitoring")
Write-Host -ForegroundColor Blue "- Disabling FAST services..."
ForEach ($SvcName in $ServicesToDisable)
{
If (Get-Service -Name $SvcName -ErrorAction SilentlyContinue)
{
Stop-Service -Name $SvcName -Force
Set-Service -Name $SvcName -StartupType Disabled
Write-Host -ForegroundColor Blue " - Service $SvcName is now disabled."
}
}
Write-Host -ForegroundColor White "- Finished disabling FAST services."
}

Function StopOCSServices
{
If (Get-Service -Name 'MSSQL$RTC' -ErrorAction SilentlyContinue)
{
Write-Host -ForegroundColor Blue "- Disabling OCS demo services..."
Set-Service -Name 'MSSQL$RTC' -StartupType Disabled
Stop-Service -Name 'MSSQL$RTC'
Get-Service | ?{$_.DisplayName -like "Office Communications*"} | Set-Service -StartupType Disabled
Get-Service | ?{$_.DisplayName -like "Office Communications*"} | Stop-Service
Write-Host -ForegroundColor White "- Finished disabling OCS services."
}
}

Function StartSPServices
{
$ServicesToSetAutomatic = ("FASTSearchService",`
"FASTSearchMonitoring",`
"MSSQLSERVER",`
"MSSQLServerOLAPService",`
"MSDtsServer100",`
"ReportServer",`
"SQLWriter",`
"W3SVC",`
"ProjectEventService14",`
"ProjectQueueService14",`
"WebAnalyticsService",`
"SPAdminV4",`
"SPTimerV4",`
"SPTraceV4",`
"SPAdminV4",`
"SPUserCodeV4",`
"FIMService",`
"FIMSynchronizationService",`
"OSearch14",`
"IISADMIN")
Write-Host -ForegroundColor Blue "- Re-enabling SP demo services..."
ForEach ($SvcName in $ServicesToSetAutomatic)
{
If (Get-Service -Name $SvcName -ErrorAction SilentlyContinue)
{
Set-Service -Name $SvcName -StartupType Automatic
Start-Service -Name $SvcName
Write-Host -ForegroundColor Blue " - Service $SvcName is now set to Automatic start"
}
}
Write-Host -ForegroundColor White "- Finished re-enabling SP demo services."
}

Function StartOCSServices
{
If (Get-Service -Name 'MSSQL$RTC' -ErrorAction SilentlyContinue)
{
Write-Host -ForegroundColor Blue "- Re-enabling OCS demo services..."
Set-Service -Name 'MSSQL$RTC' -StartupType Automatic
Start-Service -Name 'MSSQL$RTC'
Get-Service | ?{$_.DisplayName -like "Office Communications*"} | Set-Service -StartupType Automatic
Get-Service | ?{$_.DisplayName -like "Office Communications*"} | Start-Service
Write-Host -ForegroundColor White "- Finished re-enabling OCS demo services."
}
}

Function ChooseOption
{
$Choice = Read-Host "Please select:`n`
(1) - Stop ALL demo services`n`
(2) - Stop OCS demo services`n`
(3) - Stop SharePoint demo services`n`
(4) - Stop FAST services`n`
(5) - Start ALL demo services`n`
(6) - Start OCS demo services`n`
(7) - Start Sharepoint demo services`n`
(0) - QUIT`n`
Choice"

Switch ($Choice)
{
"1" {StopUnneededServices;StopSPServices;StopOCSServices;ChooseOption}
"2" {StopUnneededServices;StopOCSServices;ChooseOption}
"3" {StopUnneededServices;StopSPServices;ChooseOption}
"4" {StopFASTServices;ChooseOption}
"5" {StartSPServices;StartOCSServices;ChooseOption}
"6" {StartOCSServices;ChooseOption}
"7" {StartSPServices;ChooseOption}
"0" {break}
default {Write-Host -ForegroundColor Red "- Please select a valid option...";ChooseOption}
}
If ($Choice -eq "0") {break}
}

$Choice
If ($Choice -ne "0") {ChooseOption}

Write-Host "Press any key to exit..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")