Now i was playing with Windows Server 2012, and wanted to challenge myself into configuring the interface through powershell. I guessed it was possible as I saw some NetIP commandlets in previous encounters.
The first thing i did was trying to find the right cmdlets, the best to search them i used following synctax:
New-NetIpAddress -Ipaddress 192.168.0.3 -DefaultGateway 192.168.0.254 -InterfaceAlias Ethernet -AddressFamily IPv4 -PrefixLength 24
To set the DNS server we need to have the Interface Index number of the interface where we want to link the DNS servers settings to. The interface index number is shown by the Get-NetIpInterface cmdlet.
Setting the DNS Server is done with following Syntax:
Set-DNSClientServerAddress -Address IP First Server, IP Second Server -InterfaceIndex 'Indexnumber'
For all the netsh diehards, netsh still runs under Windows Server 2012.