As mentioned in my previous post about configuring Windows Server 2012 Core, you have multiple options. One is sconfig, but the preferred method is using PowerShell. PowerShell is a really powerful scripting language and Microsoft is pushing the use in all of their products.
In this post, I will describe how to configure your Windows Server 2012 Core installation using PowerShell. I will describe how to change your computername, set the IP address and join your server to the domain.
After you installed Windows Server 2012, log in to you server. Once logged in, the default shell is CMD. Just start powershell by typing “powershell” and press enter.
First thing I always do, is changing the computer name. The PowerShell command for this is:
Rename-Computer -NewName MYNAME
Now the computer name is changed, let’s change the IP address. We will need a few commands for this, since we need to know on which network adapter we need to change the IP address. First, use the following command:
This will output a list of available network adapters with their name, description, index and status.
As can be seen in this screenshot, the name of this adapter is “Ethernet”. We will need this name in the next command. To change the IP address on that specific network adapter, use the following command:
New-NetIPAddress -InterfaceAlias Ethernet -IPAddress 10.1.1.2 -DefaultGateway 10.1.1.1 -PrefixLength 24
Most of these values are pretty describing; ip address, gateway and interface name. The subnet mask is set by setting the PrefixLength option. A prefix length of 24 equals 255.255.255.0.
Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddress 10.1.1.1
Note that the “Ethernet” network adapter was used in this command. (found by using the Get-NetAdapter)
Since I’m not using IPv6, I always disable the option in the network adapter configuration. This can be done using PowerShell by using a few commands. First we need to know what the component name is:
Get-NetAdapterBinding -InterfaceAlias Ethernet | Select-Object Name,DisplayName,ComponentID
Note that I’m only displaying some of the properties. The most important one is the ComponentID, since that property is needed in the next command.
Disable-NetAdapterBinding -InterfaceAlias Ethernet -ComponentID ms_tcpip6
Joining the domain
Now all IP configuration is done, let’s reboot the server by using this command:
shutdown /r /t 0
Add-Computer -DomainName domain.local -DomainCredential (Get-Credential)
This will prompt you for domain credentials, just enter the correct credentials and press “OK”.
shutdown /r /t 0
And that’s it! You’ve configured your machine to be domain joined and IP configured. Hope this post was helpful for you! Feel free to leave a comment or contact me if you have any questions.