Customizing OS on Server Core Guest VM’s

Whilst recently working on our proof of concept SCVMM2012, I decided to configure the deployment of our branch office guest work loads as a Service Template, just to see if it could be done.

To give a little background, our branch office sites (are going to) contain 8 servers, based on 6 templates, but only 3 types of OS – Server 2008R2 SP1 Standard, Server 2008R2 SP1 Enterprise & Server 2008R2 SP1 Standard Core.

This allowed me to play with the 1:Many VHD:Template relationship one can establish using Guest OS Profile & Hardware Profile stacking. All went swimmingly for our various guest workloads, excluding the Server Core DC’s. When one deployed a service containing a OS customised Server Core template, the following presented in the jobs view:

SCVMM Service Depoyment Error

Error (22042)
The service (JustAD) was not successfully deployed. Review the event log to determine the cause before you take corrective action.

Recommended Action
The deployment can be restarted by retrying the job.

Information (21947)
The script command (dism.exe dism.exe /online /NoRestart /enable-feature /featurename:NetFx2-ServerCore /featurename:MicrosoftWindowsPowerShell /featurename:ServerManager-PSH-Cmdlets) was executed on the computer (debugAD3.blah.local) and returned a result exit code (87).

Error (22010)
VMM failed to enable Server Manager PowerShell on the guest virtual machine (debugAD3.primark.local). Please log into the virtual machine and look in the event logs (%WINDIR%LogsDismdism.log).

The DISM log for the relevant timeframe presents as follows:

2011-11-21 20:57:19, Info                 DISM DISM.EXE:
<—– Starting Dism.exe session —–>
2011-11-21 20:57:19, Info                 DISM DISM.EXE:
2011-11-21 20:57:19, Info                 DISM DISM.EXE: Host machine information: OS Version=6.1.7601, Running architecture=amd64, Number of processors=1
2011-11-21 20:57:19, Error                 DISM DISM.EXE: Failed validating command line: “dism.exe” dism.exe /online /NoRestart /enable-feature /featurename:NetFx2-ServerCore /featurename:MicrosoftWindowsPowerShell /featurename:ServerManager-PSH-Cmdlets
2011-11-21 20:57:19, Info                 DISM DISM.EXE: Image session has been closed. Reboot required=no.
2011-11-21 20:57:19, Info                 DISM DISM.EXE:
2011-11-21 20:57:19, Info                 DISM DISM.EXE:
<—– Ending Dism.exe session —–>

Note: When DISM is called in the customisation session, it appears to be called twice

“Dism.exe” Dism /online /NoRestart /enable-feature /featurename:NetFx2-ServerCore….

Also note: Whether the NetFx2-ServerCore, MicrosoftWindowsPowershell & ServerManager-PSH-Cmdlets are installed in the base image (or not) seems to make absolutely no difference to this. The error occurs anyway, and any configured guest role/feature customisation following this step does not occur

When I logged this with Connect, I was informed that customisation of Core guests using OS profiles will not be available in SCVMM2012. I was advised to create a base disk with all my required packages baked in. This struck me as rather inelegant, and decided to research a neater workaround.

Fortunately, I didn’t have to stray too far! It appears that Application Profiles ARE compatible with Server Core guests, so I configured an empty Application Profile with a pre-install script that applied the features I wanted to integrate via DISM:

Application Profile for Core OS guest customisation

Application Profile for Core OS guest customisation

Once this application profile was applied to my guest in the Service Template, and any OS profile applied Roles & Features removed, the service tier successfully deployed.

It's Alive!!!

Don’t worry about the info warning – that’s just feedback that the Application Profile script ran successfully e.g:

Information (21947)
The script command (C:Windowssystem32dism.exe /online /NoRestart /enable-feature /featurename:NetFx2-ServerCore /featurename:NetFx3-ServerCore /featurename:MicrosoftWindowsPowerShell /featurename:ServerManager-PSH-Cmdlets /featurename:DNS-Server-Core-Role /featurename:DirectoryServices-DomainController-ServerFoundation) was executed on the computer (JustADWorking.blah.local) and returned a result exit code (0).

With a small amount of work, I’m sure one could trim this spurious alert out. I’m not promising anything, as I’m not bothered by informational alerts, but there might be a follow up post to cover this.

I expect that this workaround might help a few SCVMM guys map put their Service Templates with a touch more consistency. However, I won’t go into any great detail as to how to throw the DISM commands together, as it’s been done to death by more experienced pro’s than me!

DISM overview:http://www.msigeek.com/2672/enable-or-disable-a-feature-from-a-wim-image-using-dism

DISM & AD roles for Server Core:http://serktools.com/2010/03/02/windows-server-core-installing-adds-role/  Enjoy!

Leave a Reply