Powershell to remove / upgrade the CMD mode to GUI mode

Powershell to remove / upgrade the CMD mode to GUI mode

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 
                } 
        }

OR

GUI On with PowerShell
The first thing we need to do is get into PowerShell, so type PowerShell and hit enter.
image
Now we need to use the Add-WindowsFeature to add the components  back:
Add-WindowsFeature Server-Gui-Shell, Server-Gui-Mgmt-Infra
Again this is just an alias for:
Install-WindowsFeature Server-Gui-Shell, Server-Gui-Mgmt-Infra
image
When its done, we will need to restart our server by using the Shutdown command:
Shutdown –r -t 0
image
When your server reboots you will have the GUI back.

OR

Turning the GUI On

Once the GUI has been turned off, you will want to know how to get it back. To do this we use SConfig, so go ahead and type SConfig into the command line and hit enter.
image
You can see near the bottom of the screen that we can use “12” to Restore the GUI, so type 12 and hit enter.

You will be warned that enabling the GUI requires a reboot, click the yes button.
image

That will kick off DISM which will start to add the binaries for the GUI Shell.
image

When its finished you will be asked if you would like to restart the computer now, type “y” and hit enter to reboot.


Comments

Popular posts from this blog

altiris software key

Troubleshooting Netlogon Error Codes

Service Principal Names (SPNs) SetSPN Syntax (Setspn.exe)