Windows 2012 R2 : Configure a Network Adapter Using PowerShell

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 -PrefixLength 24 –DefaultGateway
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses ""

Leave a Reply

Your email address will not be published. Required fields are marked *