Configuring Network Adapter TCP/IP Settings using Powershell 4.0 Cmdlets .

PowerShell 4.0 is a requirement for these cmdlets to work.The GUI( Graphic User Interface) is commonly used to configure network adapter settings or the good old netsh command. But if I had to work with Hyper-v core or Windows Server 2012 R2 core, there’s a number of PowerShell cmdlets that could be used in place of the above mentioned tools.

The traditional ipconfig displays network ip configuration. But the following cmdlet could be used to achieve the same thing more efficiently: Get-NetIPConfiguration or it’s alias gip. Any of the parameters could be used to further filter the results as indicated in the following screenshots:


The alias generates the same results:



The tcpip settings are currently dhcp based. I’ll start by displaying the netadapter and ip address before removing the ip settings, then reconfiguring them with static addresses. :


Confirm that IP Address settings have been removed (The displayed IP is the Automatic Private IP Addressing):


Set IP Address and DNS settings manually:


Display the static settings using the GUI tool:


Display the settings using ipconfig :


On a side note, if I had multiple network adapters on the host machine, I could disable DNS registration on all the NICs except the primary:

PS C:\> Set-DnsClient -InterfaceIndex 12 -RegisterThisConnectionsAddress $false

The Set-DnsClient cmdlet and it’s parameters are much more efficient and shorter in my opinion than using the Get-WmiObject -Class win32_networkadapterconfiguration class with it’s methods and properties to achieve the same result. The screenshots below show the PowerShell modules that contain the cmdlets used in this post:



This entry was posted in Hyper-v 2012 R2, PowerShell, Powershell 4.0, WIndows 8.1, Windows Server 2012 R2 and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s