In my quest to automate Windows 2012 R2 deployment (along with SQL 2014 and SharePoint 2013) I wanted to simplify the static IP addressing of my deployed VMs. The following PowerShell commands below will configure the default Network Adapter – always named “Ethernet” in a standard windows 2012 R2 deployment – the script can be easily modified to suit your environment/IP addressing requirements:
$nic = Get-NetAdapter -Name Ethernet $nic | Set-NetIPInterface -Dhcp Disabled $nic | New-NetIPAddress -IPAddress 192.168.0.201 -PrefixLength 24 –DefaultGateway 192.168.0.1 Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses "192.168.0.1"