This PowerShell script sample can be used to switch from a full installation user interface server to the server core mode in Windows Server 2012. It can also switch Windows Server 2012 from the server core mode to the full UI mode.
After setting up Windows Server 2012, IT Administrators may need to convert it to the server core for some security reason. Sometimes, it’s more convenient for IT administrators to switch back to the UI mode to modify some configurations. This script sample can help you switch between the two modes in Windows Server 2012.
You can find more All-In-One Script Framework script samples at https://aka.ms/onescriptingallery