The classic way to configure a static IP address, subnet mask, gateway, and preferred/alternative DNS servers for your network connection in Windows is to use the Network Connection GUI (use the ncpa.cpl command to quickly access this Control Panel item). You can also use the modern Settings panel in Windows 11 and 10 to set your computer’s network interface settings (Settings > Network and Internet > your network connection properties > IP Settings > IP assignments). However, in some cases, it may be more convenient and faster to use the PowerShell command line to set the Windows network settings.

List the available network interfaces
There may be more than one network adapter (Ethernet or wireless) available in Windows. To list the available network interfaces on the computer, start PowerShell prompt as an administrator and run the command:
Get-NetAdapter
In your environment, the interface name may differ. You should use the Name or InterfaceAlias value returned by Get-NetAdapter. In the examples below, we use Ethernet0 as a sample interface name.
Display the current IP address of connection
In order to display the current IP address of this connection, run the following command:
Get-NetIPConfiguration -InterfaceAlias "Ethernet0"
Use New-NetIPAddress to set static IP address for network interface
You can use the New-NetIPAddress cmdlet to set a static IP address for a network interface. For example:
New-NetIPAddress -InterfaceAlias "Ethernet0" -IPAddress 192.168.79.129 -PrefixLength 24 -DefaultGateway 192.168.79.2
Note. We recommend using -InterfaceAlias or -InterfaceIndex explicitly. Keep in mind that pipeline usage is not required for New-NetIPAddress and may cause confusion in production scripts.
Set DNS addresses for network adapter
Then you can set the DNS addresses for the network adapter:
Set-DnsClientServerAddress -InterfaceAlias "Ethernet0" -ServerAddresses 192.168.79.10,192.168.179.10
Check IP and DNS Config
After applying IP and DNS settings, you should check that the config was applied correctly. Use the following commands:
To check current IP config:
Get-NetIPConfiguration -InterfaceAlias "Ethernet0"
After that, check IP address assignment:
Get-NetIPAddress -InterfaceAlias "Ethernet0" | Select-Object IPAddress, PrefixLength
Now check DNS server config:
Get-DnsClientServerAddress -InterfaceAlias "Ethernet0"
In order to test network connectivity to gateway, run the command:
Test-NetConnection 192.168.79.2
To test external connectivity:
Test-NetConnection theitbros.com -Port 443

In case any of the checks fail, you should check:
- Correct interface selection (Get-NetAdapter)
- IP address conflicts in the network
- DNS server availability
- Firewall rules blocking ICMP/TCP traffic
Note. Keep in mind that DNS settings may apply separately for IPv4 and IPv6 interfaces.
Instance MSFT_NetIPAddress already exists issue
The first command may return an error:
New-NetIPAddress : Instance MSFT_NetIPAddress already exists.

To resolve the problem, you must remove the specified IP address from the persistent store:
Remove-NetIPAddress `
-InterfaceAlias "Ethernet0" `
-IPAddress "192.168.79.129"
Check if the IP settings of your network adapter are changed.

Check if computer has static/assigned IP address
To find out whether your computer has a static IP address or whether it has been assigned an IP address by a DHCP server, run the following command:
Get-NetIPAddress -InterfaceAlias "Ethernet0" -AddressFamily IPv4|select IPAddress,InterfaceAlias,SuffixOrigin,PrefixOrigin

If the computer’s IP address is set manually, the values for SuffixOrigin and PrefixOrigin are Manual. If the computer is using a dynamic IP address from a DHCP host, it is dhcp.
In order to display all current IPv4 and IPv6 addresses configured on a machine, use the command:
Get-NetIPAddress
Configuring IPv6 Address with PowerShell
In modern Windows environments, IPv6 is enabled by default and may be used alongside IPv4. To check current IPv6 config, use PowerShell command:
Get-NetIPAddress -AddressFamily IPv6
In order to assign a static IPv6 address, use the following command:
New-NetIPAddress -InterfaceAlias "Ethernet0" -IPAddress 2001:db8::10 -PrefixLength 64
To check IPv6 config, run the command:
Get-NetIPConfiguration -InterfaceAlias "Ethernet0"
Disabling IPv6 on Network Adapter (Optional)
Note that in some environments, IPv6 may be disabled for compatibility/troubleshooting purposes. To disable it, use the command:
Disable-NetAdapterBinding -Name "Ethernet0" -ComponentID ms_tcpip6
We recommend keeping IPv6 enabled unless you have a specific troubleshooting/compatibility requirement.
Now check IPv6 status:
Get-NetAdapterBinding -Name "Ethernet0" -ComponentID ms_tcpip6
IPv6 considerations
- IPv6 is enabled by default in modern Windows versions
- Some networks use IPv6 as primary routing protocol
- You should disable IPv6 only for troubleshooting/legacy compatibility
- Improper IPv6 config may affect DNS resolution and domain connectivity
How to Revert Network Adapter Back to DHCP
In case you previously configured a static IP address and want to restore automatic IP assignment via DHCP, you can revert the network interface settings using PowerShell. Follow the steps below:
Step 1. Remove static IP address configuration (if needed)
Get-NetIPAddress -InterfaceAlias "Ethernet0" -AddressFamily IPv4 |
Where-Object { $_.PrefixOrigin -eq "Manual" } |
Remove-NetIPAddress -Confirm:$false
Note that default gateway is automatically managed when DHCP is enabled for the interface. Also, keep in mind that any manually configured default gateways are removed automatically when switching to DHCP.
Step 2. Enable DHCP for IP configuration
Set-NetIPInterface -InterfaceAlias "Ethernet0" -Dhcp Enabled
# Reset IPv4 routes (ensures gateway is cleaned up)
Get-NetRoute -InterfaceAlias "Ethernet0" -AddressFamily IPv4 |
Where-Object { $_.Publish -eq "Yes" } |
Remove-NetRoute -Confirm:$false
Note that in most cases Windows automatically removes static routes when DHCP is enabled.
Step 3. Enable DHCP for IPv6 (important for dual-stack environments)
Set-NetIPInterface -InterfaceAlias "Ethernet0" -AddressFamily IPv6 -Dhcp Enabled
This ensures that any static IPv6 config does not persist after switching to DHCP mode.
Step 4. Reset DNS configuration to automatic mode
Set-DnsClientServerAddress -InterfaceAlias "Ethernet0" -ResetServerAddresses
Step 5. Verify DHCP configuration
Get-NetIPInterface -InterfaceAlias "Ethernet0" | Select-Object Dhcp
Step 6. Confirm new IP assignment
Get-NetIPConfiguration -InterfaceAlias "Ethernet0"
Step 7. Renew IP lease (optional)
In order to immediately request a new DHCP lease without waiting for the automatic renewal interval, run the following command:
ipconfig /renew
Note that this step is optional. Normally, Windows will request a DHCP lease automatically after DHCP is enabled on the network interface.
Validate DNS Settings After Network Changes
After modifying network settings, you can use the following steps in order to verify DNS config and troubleshoot name resolution problems:
Step 1. Clear DNS cache
Clear-DnsClientCache
Step 2. Validate DNS settings
Get-DnsClientServerAddress -InterfaceAlias "Ethernet0"
Step 3. Test DNS resolution
Resolve-DnsName theitbros.com

In case you want to verify that a specific DNS server is responding correctly, you can query it directly with the command:
Resolve-DnsName theitbros.com -Server 192.168.79.10
Step 4. Test multiple adapter cases
Get-NetAdapter | Select-Object Name, InterfaceAlias, Status
Step 5. Optional DNS server reachability test
Test-NetConnection 192.168.79.10 -Port 53
DNS notes
- DNS changes may not take effect immediately without cache flush
- Multiple network adapters may require per-interface config
- Incorrect DNS config can break domain resolution and internet access
