Categories

Working with Server Core–setting IP addresses

When you create a new Windows machine it defaults to using DHCP to get an IP address. While that is fine for client machines most people apply a static address to their servers. Up until Windows 2012 you had 2 choices – use the GUI or use PowerShell and WMI.

Server 2012 introduced a host of cmdlets for administering your network settings.  Setting an IP address is simple as this:

New-NetIPAddress -InterfaceIndex 12 -IPAddress '10.10.55.101' -AddressFamily IPv4 -PrefixLength 24

 

I haven’t used it but you can also set the default gateway which would make the command

New-NetIPAddress -InterfaceIndex 12 -IPAddress '10.10.55.101' -AddressFamily IPv4 -PrefixLength 24 -DefaultGateway '10.10.55.01'

 

The DNS server addresses can be set like this

Set-DnsClientServerAddress -InterfaceIndex 12 -ServerAddresses '10.10.55.100'

 

The cmdlets are from the NetTCPIP and DnsClient modules respectively.

THESE MODULES ARE ONLY AVAILABLE ON WINDOWS 8/2012 AND LATER.

Leave a Reply