Switch from Windows 2012 Core to GUI mode…hands on!

Usually, you’d first install a server with a GUI, complete its configuration and remove its UI for all the good reasons related to security.

But if you’ve started by installing a Core version and try to add back its GUI, you may encounter the famous error 0x800f0906 that you also get when you try to install .Net 3.5 and that was reported by Mike F Robbins here.

Whenever you do

Install-WindowsFeature -Name "Server-Gui-Mgmt-Infra" -Restart:$false

You end with:


Install-WindowsFeature : The request to add or remove features on thespecified server failed.
Installation of one or more roles, role services, or features failed.
The source files could not be downloaded.
Use the "source" option to specify the location of the files that are required to restore the feature. For more information on specifying a source location,
see http://go.microsoft.com/fwlink/?LinkId=243077. Error: 0x800f0906

Actually by invoking Install-WindowsFeature like this, we ask it to get the source online from Microsoft as we did not specified a local source as parameter.

You may wonder if there’s a connection problem or a name resolution issue.
Actually there isn’t. The result 200 (status: OK) is returned by the following command:

Invoke-WebRequest -Uri http://www.google.com -UseBasicParsing

So, we can deduct that the online source is not available. Let’s try to use a local source instead of using the default online parameter

The following technet page http://technet.microsoft.com/en-us/library/hh831786.aspx says that

To use Windows PowerShell to convert from a Server Core installation to a Server with a GUI installation

Determine the index number for a Server with a GUI image (for example, SERVERDATACENTER, not SERVERDATACENTERCORE) with Get-WindowsImage -ImagePath \install.wim.

Run Install-WindowsFeature Server-Gui-Mgmt-Infra,Server-Gui-Shell –Restart –Source c:\mountdir\windows\winsxs

Alternatively, if you want to use Windows Update as the source instead of a WIM file, use this Windows PowerShell cmdlet:

Install-WindowsFeature Server-Gui-Mgmt-Infra,Server-Gui-Shell –Restart

…but that’s not totally accurate.

Fortunately the following recent blog post help us solve the famous error 0x800f0906

The first step is to get the original install source. Instead of putting the DVD in a physical drive, you just do the following on a hyper-V server:

Set-VMDvdDrive -Path D:\Downloads\SW_DVD5_Win_Svr_Std_and_DataCtr_2012_64Bit_English_Core_MLF_X18-27588.ISO -VMName MyVMName            
Get-WindowsImage -ImagePath D:\sources\install.wim

Then there’s no need to mount it, you just have to invoke directly the install-WindowsFeature cmdlet like this:

Install-WindowsFeature server-gui-mgmt-infra -source:wim:d:\sources\install.wim:2 -Restart:$false

Why it failed on the first place ?

It failed because the feature is not available and its source files have been removed. This corresponds to the following status
get-windowsfeature default state on core
dism payload removed

I just used the following commands to get the above screenshots

dism /online /get-features            
Get-WindowsFeature | ft Name,InstallState

But the result of the Install-WindowsFeature has another explanation:
install-WindowsFeature
It tells us that it failed because Windows Update wasn’t yet configured on the core server…

Wait, let’s go back 2 seconds to the basics we’ve just figured out.
There are 3 states for features and here is the corresponding states between dism and the get-windowsfeature cmdlet:

DISM states: Get-WindowsFeature states:
Enabled Installed
Disabled Available
Disabled with Payload Removed Removed

Humm, there’s more!

The product manager said in the MS forum on March that

If you wanted to create a centralized network install point that you could point to, you could extract the wim and then merge the contents of the sxs directory on the media with the winsxs directory in /windows/winsxs to have a single source that could install all features. Hope this makes sense! Let me know if you have any more questions or feedback about Features on Demand.

…sounds cool 🙂

# Extract all the required source directories            
            
# 1. Create an empty directory             
mkdir c:\mount            
# 2. Mount the Standard image            
Mount-WindowsImage -Path C:\mount -ImagePath D:\sources\install.wim -Index 2 -ReadOnly            
# 3. Get the WinSXS from the install.wim            
robocopy  C:\mount\Windows\WinSxS \\DISTRIBSERVER\Share\WS2012\STD_WINSXS /S /r:0 /Z            
# 4. Dismount the WIM file            
Get-WindowsImage -Mounted | Dismount-WindowsImage -Discard            
# 5. Mount the Datacenter image            
Mount-WindowsImage -Path C:\mount -ImagePath D:\sources\install.wim -Index 4 -ReadOnly            
# 6. Get the WinSXS from the install.wim            
robocopy  C:\mount\Windows\WinSxS \\DISTRIBSERVER\Share\WS2012\DTC_WINSXS /S /r:0 /Z            
# 7. Dismount the WIM file            
Get-WindowsImage -Mounted | Dismount-WindowsImage -Discard            
# 8. Copy the SXS folder from the ISO image            
robocopy  D:\sources\sxs  \\DISTRIBSERVER\Share\WS2012\SXS /S /R:0 /Z

Simulating some robocopy from the STD_WINSXS to the DTC_WINSXS folder shows that there are very few differences. There are some additions and only the FileMaps folder content is different. In other words, it’s the perfect candidate for a partition with deduplication on.

Advertisements

3 thoughts on “Switch from Windows 2012 Core to GUI mode…hands on!

  1. Pingback: Windows Server 2012 – converting between core, gui and minimal interface versions | IT bits and pieces

  2. Pingback: Installing the GUI on Windows Server 2012 Core « A Database Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s