Share via


Powershell 3.0 Script Menu: Turn ON/OFF Windows Server 2012/R2 Core Mode

####################################################################################################

# PSMenu_Enable_Disable_Core_Gui.ps1

#

# v1.1 March 2015 by Kévin KISOKA

#

# Information :

#

# You will find descriptions about the cmdlets scopes and which features will be availables after using it.

# Url: http://technet.microsoft.com/fr-fr/library/hh831786.aspx

#

#

# Script Usage :

#

# Menu action :

#

# - Select option 1 to Fully Disable Graphical User Interface Foundations (like old core version of Windows Server or Hyper-V Stand Alone)

# - Select option 2 to Disable Graphical User Interface Foundations, things like MMCs or Server Manager will remain availables.

# - Select option 3 to Enable Graphical Graphical User Interface and Infrastructure Core Management.

#

#

#####################################################################################################

 

 

 

 

 

[System.Console]::ForegroundColor = [System.ConsoleColor]::White

clear-host

write-host

write-host Script for Desabling or Enabling the GUI

write-host

write-host Please choose one of the following: -foregroundcolor:Green

write-host

write-host '1) Fully Disable Graphical User Interface'

write-host '2) Disable Graphical User Interface Foundations (MMC,ServerManager will be available)'

write-host '3) Enable Full Graphical User Interface'

[int]$menu = Read-Host "Select an option [1-3]"

switch ($menu) {

1{

# Print progress info to Host

Write-host Work in progress ... `r -foregroundcolor:Yellow

# Removing features

Try {Uninstall-WindowsFeature Server-Gui-Mgmt-Infra,Server-Gui-Shell}

Catch {Write-Warning "Err_Uninstall Gui-Shell,Gui-Infra" $_.Exception.Message}

 

}

2{

# Print progress Info to Host

Write-host Work in progress ... `r -foregroundcolor:Yellow

# Removing features

Try{Uninstall-WindowsFeature Server-Gui-Shell}

Catch {Write-Warning "Err_Uninstall Gui-Shell" $_.Exception.Message}

}

3{

# Print progress Info to Host

Write-host Work in progress ... `r -foregroundcolor:Yellow

# Removing features

Try{Add-WindowsFeature Server-Gui-Shell,Server-Gui-Mgmt-Infra}

Catch {Write-Warning "Err_Install Gui-Shell,Gui-Infra" $_.Exception.Message}

}

}