How to Configure an IP Address Using PowerShell on Windows

If you are coming from Linux to Windows and you are used to working on the shell, then the following PowerShell commands might be the right ones for you.

Get an IP Address Configuration

You can use the following command to check the IP address configuration of your computer. It works the same way as ipconfig or ifconfig in Linux

Get-NetIPConfiguration

Get a List of Network Adapters

You can get the detailed list of network adapters installed on your computer with this command:

Get-NetAdapter

Configure an IP Address

To configure an IP address in your computer, type the following command where InterfaceIndex is the index of your network adapter. You can identify this number by using the Get-NetAdapter command described above.

New-NetIPAddress -InterfaceIndex 2 -IPAddress 192.168.1.10 -PrefixLength 24 -DefaultGateway 192.168.1.1

Rename Network Adapter

To rename an existing network adapter, execute this command.

Rename-NetAdapter -Name Ethernet -NewName IntConnection

Disable Network Adapter

To disable an existing network adapter, use:

Disable-NetAdapter -ifAlias IntConnection

Enable Network Adapter

If you have disabled any network adapter and you would like to enable it, here is the command.

Enable-NetAdapter -ifAlias IntConnection

Leave a Comment