How to switch between Server Core mode and Server GUI mode in Windows Server 2012

Introduction

This script sample can be used to switch a full installation of a Server Graphic User Interface (GUI) mode to Server Core mode in Windows Server 2012. Additionally, this script enables you to convert Server Core mode to Server GUI mode.


Download Windows Server 2012
Download Your FREE Copy of Hyper-V Server 2012

Scenarios

After you setup Windows Server 2012, IT administrators may have to convert Server 2012 to Server Core mode for some security reasons.  Also, it is more convenient for administrators to change some configurations when using GUI mode.  To perform this action, use the following script sample.

Script

How to run the script:

  1. Open PowerShell in “Run as Administrator” mode.
  2. Switch to the path where you downloaded the script.
  3. Run the script directly.

Here are some code snippets for your references.

PowerShell
Edit|Remove
switch ($id) 
        { 
            "1" {Uninstall-WindowsFeature Server-Gui-Mgmt-Infra,Server-Gui-Shell} 
            "2" {Install-WindowsFeature Server-Gui-Mgmt-Infra,Server-Gui-Shell} 
            "3" { 
                    Import-Module Dism 
                    Enable-WindowsOptionalFeature -online -Featurename ServerCore-FullServer,Server-Gui-Shell,Server-Gui-Mgmt 
                } 
        }

Examples

Example 1: How to switch to Server Core mode.

To switch to Server Core mode, run this script directly, and then select number “1”:
Note: If Server 2012 with the Server Core option has never converted to Server GUI mode, this server will not contain the necessary source file to switch to GUI mode (option 2). Please keep the server online (connected to the Internet) and select option 3.

Additional Resources

Technical Resources:

Install-WindowsFeature

http://technet.microsoft.com/en-us/library/jj205467.aspx

Windows Server Installation Options

http://technet.microsoft.com/en-us/library/hh831786.aspx