How to Configure IP Address with PowerShell?

The IP address configuration is easy when you configure it using GUI. But do you know how to configure IP address using PowerShell or even command prompt (cmd)? Good if you know, but if you don’t know just follow this step by step article about configure IP address using PowerShell.

I have wrote an article about configure IP address with command line before. You can read it from configure IP address with CMD or command prompt using Network Shell or Netsh utility.

Configure IP Address using PowerShell

It’s for Sysadmins those who are already know IP address classes, subnetting, deploying IP with DHCP server or some basic IP address knowledge, and tech enthusiast that like to learn more every day.

1. Try to run PowerShell as administrator by searching PowerShell on Windows search and pressing Ctrl+Shift then press enter. It will open the PowerShell as administrator.

2. To see the IP configuration, type “Get-NetIPConfiguration” and press enter. It works the same as “Ipconfig” on command prompt and “Ifconfig” command on Linux.

Display IP Configuration with PowerShell
Display IP Configuration with PowerShell

3. The “Get-NetAdapter” command can shows all network adapters on your computer. It display the virtual network adapters as well.

Find Network Adapters with PowerShell
Find Network Adapters with PowerShell

The following command will help you find more information about network adapters. The “Get-NetAdapterHardwareInfo” shows hardware information and…

4. For example type “Get-NetAdapter | ft Name, DriverFileName, DriverData, DriverDescription“.

Network Adapter Information
Network Adapter Information

There are more parameters for Network Adapter cmdlet, so try to find them with “Get-Help Get-NetAdapter -Detailed” command.

Get help of Network Adapters
Get help of Network Adapters

That’s all, you need to work with PowerShell to learn more about network adapter configuration or configure IP address with PowerShell.

Configure IP Address with PowerShell

Like the old network shell (Netsh), you can configure IP address with PowerShell as well. It’s just changed to PowerShell cmdlet.

1. To change a network adapter IP address, do it with “New-NetIPAddress”.

New-NetIPAddress -InterfaceIndex 2 -IPAddress 200.100.10.1 -PrefixLength 24 -DefaultGateway 200.100.10.10

Assign IP Address with PowerShell - Configure IP Address Using PowerShell
Assign IP Address with PowerShell – Configure IP Address Using PowerShell

The index 2 is the index number of my network adapter on Windows 10. You can find the index number with “Get-NetAdapter“.

2. To set DNS address use the “Set-DNSClientServerAddress“.

Set-DnsClientServerAddress -InterfaceIndex 2 -ServerAddresses 200.100.10.50

Set DNS Address using PowerShell
Set DNS Address using PowerShell

To set alternate DNS server just add the second DNS address with comma.

Set-DnsClientServerAddress -InterfaceIndex 2 -ServerAddresses 200.100.10.50, 200.100.10.100

Internet Protocol TCP IPv4 Properties
Internet Protocol TCP IPv4 Properties

To view the result with PowerShell, type “Get-NetIPConfiguration” and press enter. It will shows all adapters IP configurations.

Rename Network Adapter:

To rename a network adapter, type “Rename-NetAdapter -Name Ethernet -NewName IntConnection” and press enter. The Ethernet is the old name and the IntConnection is the new name.

Rename Network Adapter with PowerShell
Rename Network Adapter with PowerShell

Disable Network Adapter:

To disable a network adapter, simply type “Disable-NetAdapter -ifAlias IntConnection” and press enter. Just type Y to disable network adapter with PowerShell.

Disable Network Adapter with PowerShell
Disable Network Adapter with PowerShell

Enable Network Adapter:

Do the same as disable network adapter and replace the disable to enable and press enter to enable network adapter with PowerShell.

Enable Network Adapter with PowerShell
Enable Network Adapter with PowerShell

That’s all you need to know about to configure IP address Using PowerShell on the network. If I forgot some command, tell me about configuring IP address using PowerShell and feel free to ask us through comment section. We are on the way of helping you.

You might also like
2 Comments
  1. Martin says

    Thank you very much. These commands were very helpful.

  2. proxy free list says

    Hello,I log on to your blog named “How to Configure IP Address Using PowerShell? – Technig” daily.Your story-telling style is awesome, keep it up! And you can look our website about proxy free list.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.