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.
3. The “Get-NetAdapter” command can shows all network adapters on your computer. It display the virtual network adapters as well.
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“.
There are more parameters for Network Adapter cmdlet, so try to find them with “Get-Help Get-NetAdapter -Detailed” command.
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 188.8.131.52 -PrefixLength 24 -DefaultGateway 184.108.40.206
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 220.127.116.11
To set alternate DNS server just add the second DNS address with comma.
Set-DnsClientServerAddress -InterfaceIndex 2 -ServerAddresses 18.104.22.168, 22.214.171.124
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.
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.
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.
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.