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
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.
How to run the script:
Here are some code snippets for your references.
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
}
}
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 } }
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.
Technical Resources:
Install-WindowsFeature
http://technet.microsoft.com/en-us/library/jj205467.aspx
Windows Server Installation Options