Friday, August 10, 2012

How to convert a full server 2012 to a core installation

To convert a full operating system installation to a server core installation using dism
Dism /online /disable-feature /featurename:ServerCore-FullServer
To convert a full operating system installation to a server core installation using powershell
Disable-WindowsOptionalFeature -online -Featurename Servercore-Fullserver
To convert a server core installation back to a full operating system installation using dism
Dism /online /enable-feature /featurename:Server-Gui-Mgmt /featurename:Server-Gui-Shell /featurename:ServerCore-FullServer
To convert a server core installation back to a full operating system installation using powershell
Enable-WindowsOptionalFeature -online -Featurename Servercore-FullServer,Server-Gui-shell,Server-Gui-MgmtFor servers with server core as the base installation perform the following steps to convert to a full operating system installation
Create an folder called C:\ws12\image
Insert the Windows 2012 media into the optical drive and type :
Copy install.wim from D:\sources\install.wim to C:\ws12\image
Run the following command to retrieve the name or index number of the image:
Dism /Get-ImageInfo /ImageFile:C:\ws12\image\install.wim
Run the following command to mount the offline Windows image (Note: index:2 = Standard Edition index:4 = Datacenter Edition) :
Dism /Mount-Image /ImageFile:C:\ws12\image\install.wim /index:2 /MountDir:C:\ws12\MountPoint
Upgrade the operating system by running the command:
Dism /online /enable-feature /featurename:Server-Gui-Mgmt /featurename:Server-Gui-Shell featurename:ServerCore-FullServer /source:c:\ws12\MountPoint\windows\winsxs
Run the following command to convert a full operating system installation back to a server core installation:
Dism /online /disable-feature /featurename:ServerCore-FullServer
For more information read this post.

Wednesday, August 8, 2012

How to enable remoting in a windows server 2012 core

From a command line on the server machine enter
winrm qc
Press y to continue
If the server is not a domain member you can remotely manage it from a workstation adding workstation's ip in wsman trusted hosts using the command:
winrm set winrm/config/client @{TrustedHosts="x.x.x.x"}
where x.x.x.x is the IP address or the computer name of the workstation machine
In the workstation machine enable winrm using the command
winrm qc
and
winrm set winrm/config/client @{TrustedHosts="x.x.x.x"}
where x.x.x.x is the IP address or the computer name of the server machine
After that you can connect to the remote machine using the command
winrs -r:http://x.x.x.x:5985 -u:username "command"
where x.x.x.x is the IP address or the computer name of the server machine, username a user with admin persmissions on the server machine and command the command to execute on the server machine.
Example:
winrs -r:http://192.168.10.10:5985 -u:Administrator "cmd"
For more information take a look at the following post

How to rename the local Administrator account in server core

Enter this command to rename local Administrator account to a new name:
wmic UserAccount where Name="Administrator" call Rename Name="new-name"

In Windows Server 2012 Core we can utilize Powershell, so to find the Local Administrator account name we use the following command:
gwmi Win32_UserAccount | ? {$_.SID -Like 'S-1-5-*-500'}
In order to rename the Local Administrator account to another name we use the following command:
(gwmi Win32_UserAccount | ? {$_.SID -Like 'S-1-5-*-500'}).Rename("New-Name")