I had a wonky epiphany the other day as a colleague asked (in a slightly off tone)… “Why are we running Server Core for the hypervisors??” I could only respond with “good point”. There is no clear justification preventing us from using core, I guess the admin who configured these servers installed core without any of the expected GUI features. And to top it off, the initial installer left us with no WIM files and documented way to use the /online dism switch to go outbound and download the features from Microsoft.
Here is what we ended up doing to get past the persistent DISM error: ‘the source files could not be found and download failed, their location an be specified using the /source option’
For starts, here is the DISM Command we were running (and failing):
dism /online /enable-feature /featurename:servercore-fullserver /featurename:server-gui-shell /featurename:server-gui-management
Now the above command would normally work assuming our Server 2012 Core configuration had the capability of attaching to Microsoft and downloading the features. Unfortunately this was not the case.
As a test, and hoping we could just easily add the proxy server and download with dism /online by keying in the following command:
::Server = proxy server ::Port = proxy server port netsh winhhtp set proxy server:port
The netsh attempt failed, although it was a decent attempt (I’m a huge NETSH fan). Onward! Here is how we really fixed the issue. It turned out that we did have a wim file from a hypervisor that was recent rebuilt for documentation. Here are the steps we used to finally install the roles and make life a tad bit easier for the rest of us:
- Logon to the hypervisor that had a copy of the Server 2012 .wim file and copy it locally
- Lets start fresh, for documentation – lets create a new directory –> MKDIR c:\las
- Copy the wim from the staging area to the c:\las directory –> copy D:\temp\install.wim C:\las\wim
- jump into powershell and fire up the DISM module –> Import-Module DISM
- get the name/index of the wim with the following powershell command –> Dism /Get-ImageInfo /ImageFile:C:\las\image\install.wim
- create a folder to mount the wim to –> mkdir C:\las\2012mount
- run the following command to perform the wim mount. Note index 2 = 2012 standard, and index 4 = datacenter–> Dism /Mount-Image /ImageFile:C:\las\wim\install.wim /index:4 /MountDir:C:\las\2012mount /ReadOnly
- now we are ready to finally add the roles using powershell (since we are already in it)–> Install-WindowsFeature Server-Gui-Mgmt-Infra,Server-Gui-Shell –Restart –Source c:\las\2012mount\windows\winsxs
- note – using the -restart command will force the instance to reboot. If you happen to be hosting a hyper-v server with running instances, it will take quite some time to bounce the server. don’t worry, its completely fine.
I hope the above helps when you are tossed into a situation like the one we were just in. I guess, in all honesty its in everyone’s best interest to minimize reboot risk at the hypervisor level and use only core with no gui. That way when a toolish admin decides to update a random app and reboot the hypervisor, the instances stay safe.
Now say you want to revert the above changes and get back to a non gui state for the hypervisor, run the following.
- Logon to the hypervisor
- jump into command line and launch powershell
- fire up the DISM module –> Import-Module DISM
- run the following to remove the installed GUI features –> Remove-WindowsFeature Server-Gui-Mgmt-Infra,Server-Gui-Shell –Restart –Source c:\las\2012mount\windows\winsxs