What is the difference between knowledge and wisdom?
Is it as Miles Kington said, "Knowledge is knowing the tomato is a fruit, wisdom is not putting it in your fruit salad". Or is knowledge learning by your experience, and wisdom is learning through other people's experiences? Let's make this post use the second option, and discuss what was observed on an recent(ish) trip.
The crux of this tale is that the server admin was faced with the below screenshot after removing PowerShell 4.0 from a Windows 2012 R2 server. This had been a GUI install prior to the restart. The GUI was unexpectedly removed, and we were back to a cmd prompt….
Now Its Gone, Gone, Gone
(Courtesy link to Righteous Brothers you've lost that loving feeling, oh all right if you insist Top Gun as well…..)
Trying to start explorer.exe or PowerShell.exe ended in tears. They were simply gone.
If we check using Deployment Image Servicing and Management (DISM) to see what is present, all of the PowerShell items are disabled:
Dism /Online /Get-Features /Format:Table | Findstr /i "PowerShell"
The same for the graphical items:
Dism /Online /Get-Features /Format:Table | Findstr /i "gui"
Let's roll the clock back like none of the above happened, and repeat what the admin did from the very beginning.
Revisiting PowerShell 4.0 Removal
This is a fresh Windows Server 2012 R2 system. It was installed with the standard graphical shell. No changes have been made. The Remove Roles and Features wizard was started. Note that the graphical shell is installed along with the graphical tools.
Scrolling down we also see that PowerShell 4.0 is currently installed.
Let's remove PowerShell 4.0 by clearing its check box.
When the PowerShell 4.0 check box is removed, a confirmation dialog box is displayed as some other features rely upon PowerShell 4.0.
Since the graphical shell relies upon PowerShell 4.0, removing PowerShell 4.0 uninstalls the graphical shell. Note that they have been highlighted in the confirmation pop-up window.
This is also reflected in the confirmation screen. Again highlighted below.
Clicking the remove button initiates the removal.
Alright – that explains where the graphical shell went.
If we do find ourselves in this pickle, what can do we do to install the graphical tools onto a Server 2012/2012 R2 machine?
Bring It Back, Bring It Back, Don't Take It Away From Me…
(Courtesy link to Queen – Love Of My Live)
Since PowerShell is not present, we cannot use Install-WindowsFeature to install it. That would be chicken and egg. Instead we can use DISM. For example to add PowerShell back
Dism.exe /online /enable-feature /featurename:MicrosoftWindowsPowerShellRoot
Rather than running several move individual commands, we can combine multiple features in a single command. In this example we add back in the GUI components.
Dism /online /enable-feature /featurename:Server-Gui-Mgmt /featurename:Server-Gui-Shell /featurename:ServerCore-FullServer
The system was rebooted to apply the changes.
Return Of The Mac GUI
(Chose not to provide link to Mark Morrison's Return Of The Mac) *
Funnily enough when logging back on, since Server Manager was present once again, it reported the result of it's last task – which was to remove PowerShell and the Graphical Management Tools & Infrastructure.
Graphical/Core Installation Options Unchained
(Courtesy link to Righteous Brothers Unchained Melody)
As noted on TechNet, in Windows Server 2008 R2 and Windows Server 2008, the Server Core installation and the full installation options were selections that an administrator only made at the time of installation. Once a path was chosen, it was set in stone and that was it. There was no way to transition from core to full server without re-installing the box. This can be illustrated by the two separate items in the graphic below.
In Windows Server 2012 onwards, note that the installation options build upon one another. It is this which allows us to add/remove the GUI and transition from one to the other.
* – just because.