Windows for Linux Geeks: Making Windows Server 2012 Core manageable

 

First, Windows server core now comes with the SCONFIG menu driven utility.  With this you can rename the computer, join a domain, enable remote desktop, etc;

sconfig

However,  it doesn’t have any options for configuring the firewall and when enabling remote desktop/administration one has to do that manually from the comand line.   So here’s a rundown of basic firewall configuration commands:

Enable/disable the firewall completely:

netsh advfirewall set allprofiles state [ on | off ]

Reset the firewall:

netsh advfirewall reset

Query all firewall rules:

netsh advfirewall firewall show rule name=all

Block and enable ping:

netsh advfirewall firewall add rule name="PING" dir=in action=block protocol=icmpv4
netsh advfirewall firewall add rule name="PING" dir=in action=allow protocol=icmpv4

Enable Remote Desktop:

netsh advfirewall firewall set rule group="remote desktop" new enable=yes

Enable remote management:

netsh advfirewall firewall set rule group="remote administration" new enable=yes

Enable/disable a specific port, such as for SQL Server:

netsh advfirewall firewall add rule name="SQL Server Port 1433" dir=in action=allow protocol=tcp localport=1433
netsh advfirewall firewall delete rule name="SQL Server Port 1433" protocol=tcp localport=1433

Finally you can install/remove the GUI with these powershell commands:

PS C:\>Install-WindowsFeature  Server-Gui-Mgmt-Infra,Server-Gui-Shell -Restart
PS C:\>Uninstall-WindowsFeature  Server-Gui-Mgmt-Infra,Server-Gui-Shell -Restart