---
title: "PowerShell IP Configuration: A Beginner’s Guide to Windows Settings"
description: "Master PowerShell IP Configuration: Learn to set up and troubleshoot network IPs on Windows effortlessly. A comprehensive guide for efficient network management."
canonical: "https://adamtheautomator.com/powershell-ip-configuration/"
---

# PowerShell IP Configuration: A Beginner’s Guide to Windows Settings

> Master PowerShell IP Configuration: Learn to set up and troubleshoot network IPs on Windows effortlessly. A comprehensive guide for efficient network management.

Source: https://adamtheautomator.com/powershell-ip-configuration/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![PowerShell IP Configuration: A Beginner’s Guide to Windows Settings](https://adamtheautomator.com/wp-content/uploads/2023/03/powershell-ip-configuration.jpg)

# PowerShell IP Configuration: A Beginner’s Guide to Windows Settings

[![](https://secure.gravatar.com/avatar/4147968aa2332aa682bcebf295e4e9d0eb2672dee3d9ae0523a00ac51e7d6017?s=192&d=mm&r=g)Bill Kindle](https://adamtheautomator.com/author/bill/)5 February 20244 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[Networking](/tag/networking/)[PowerShell](/tag/powershell/)[Windows](/tag/windows/)

Table of Contents

*   [Prerequisites](#prerequisites)
*   [Getting Network Adapter Properties (Get-NetAdapter)](#getting-network-adapter-properties-get-netadapter)
*   [Retrieving an Address PowerShell IP Configuration (Get-NetIPAddress)](#retrieving-an-address-powershell-ip-configuration-get-netipaddress)
*   [Getting the IP Route Information (Get-NetRoute)](#getting-the-ip-route-information-get-netroute)
*   [Getting DNS Server IP Addresses (Get-DnsClientServerAddress)](#getting-dns-server-ip-addresses-get-dnsclientserveraddress)
*   [Getting IP Network Configurations (Get-NetIPConfiguration)](#getting-ip-network-configurations-get-netipconfiguration)
*   [Configuring IP, Gateway, and DNS Address Manually](#configuring-ip-gateway-and-dns-address-manually)
*   [Conclusion](#conclusion)

A common SysAdmin task involves managing a PowerShell IP configuration. Typically, one performs this task using the GUI, which is OK. But PowerShell can do the same job and more, which you can put into scripting.

In this tutorial, you will learn how to use a few network management cmdlets in PowerShell to help manage a Windows host’s IP address, gateway, and DNS settings.

Read on, and level up your network troubleshooting skills with PowerShell IP configuration commands!

## Prerequisites

This tutorial comprises hands-on demonstrations. You will need administrative access to PowerShell on a modern Windows OS to follow along. This tutorial uses Windows Server 2022, but the commands work on Windows 10 versions and newer.

## Getting Network Adapter Properties (`Get-NetAdapter`)

In troubleshooting or gathering a host’s IP address, you could use traditional tools like `ping`, `ipconfig`, or `sconfig`. But with PowerShell cmdlets, you can script this process for automation.

Open PowerShell and run the below [`Get-NetAdapter`](https://learn.microsoft.com/en-us/powershell/module/netadapter/get-netadapter?view=windowsserver2022-p) cmdlet to get the list of network adapters and their properties, such as your host’s **InterfaceAlias** and **InterfaceIndex**.

```powershell
Get-NetAdapter
```

![Getting network adapters’ properties](https://adamtheautomator.com/wp-content/uploads/2023/03/image-12.png)

Getting network adapters’ properties

> _Note that your adapter does not have an IP Address object yet. You need to know which one you are going to use. For this tutorial, you are working with the adapter alias of Ethernet._

## Retrieving an Address PowerShell IP Configuration (`Get-NetIPAddress`)

You previously listed all the network interfaces with a single command. But you can also list property values and your host’s current IP address via the [`Get-NetIPAddress`](https://learn.microsoft.com/en-us/powershell/module/nettcpip/get-netipaddress?view=windowsserver2022-ps) cmdlet.

Related: [How to Use PowerShell to Get an IP Address](https://adamtheautomator.com/powershell-get-ip-address/)

Run the below cmdlet (without parameters) to display each adapter’s address and PowerShell IP configuration.

```powershell
Get-NetIPAddress
```

![Getting all IP address configurations](https://adamtheautomator.com/wp-content/uploads/2023/03/image-13.png)

Getting all IP address configurations

Now, run the following command to narrow the output (Select-Object) to the Ethernet’s `InterfaceAlias` and `IPAddress`.

```powershell
Get-NetIPAddress -InterfaceAlias Ethernet | Select-Object -Property InterfaceAlias,IPAddress
```

![Finding the IP address assigned to an interface (Ethernet)](https://adamtheautomator.com/wp-content/uploads/2023/03/image-14.png)

Finding the IP address assigned to an interface (Ethernet)

## Getting the IP Route Information (`Get-NetRoute`)

An IP address enables a host to communicate with others on the same network. But what happens when the host needs to communicate outside that network?

A gateway address is necessary, and the [`Get-NetRoute`](https://learn.microsoft.com/en-us/powershell/module/nettcpip/get-netroute?view=windowsserver2022-ps) cmdlet is what you need. This cmdlet provides information that previous cmdlets you have learned about do not.

Run the below `Get-NetRoute` command to check the current gateway (`NextHop`) for the `Ethernet` interface.

```powershell
Get-NetRoute -InterfaceAlias Ethernet | Where-Object -Property RouteMetric -EQ 0 | Select-Object -Property NextHop
```

Typically, a DHCP server supplies the gateway address. You’ll want to capture this address later for this article.

![Finding the gateway address assigned to an interface](https://adamtheautomator.com/wp-content/uploads/2023/03/image-15.png)

Finding the gateway address assigned to an interface

## Getting DNS Server IP Addresses (`Get-DnsClientServerAddress`)

DNS is necessary for name resolution for both internal and external networks. Without DNS, you would have to remember the internet address for each host on your network.

But chances are that your host has DNS already configured through DHCP. You can use the [`Get-DnsClientServerAddress`](https://learn.microsoft.com/en-us/powershell/module/dnsclient/get-dnsclientserveraddress?view=windowsserver2022-ps) cmdlet to verify the current configuration.

```powershell
Get-DnsClientServerAddress
```

Record the IP addresses by redirecting the output to a text file or writing them down. You will need to reassign these DNS server addresses later in this tutorial.

Related:[Using PowerShell Out-File Cmdlet to Redirect Output to a File](https://adamtheautomator.com/out-file/)

![Verifying the current DNS configuration](https://adamtheautomator.com/wp-content/uploads/2023/03/image-16.png)

Verifying the current DNS configuration

## Getting IP Network Configurations (`Get-NetIPConfiguration`)

When you need the information the previous three cmdlets you have learned about in one go, the [`Get-NetIPConfiguration`](https://learn.microsoft.com/en-us/powershell/module/nettcpip/get-netipconfiguration?view=windowsserver2022-ps) cmdlet will do the trick. This cmdlet’s one prominent feature is it provides more focused information.

Run the `Get-NetIPConfiguration` cmdlet below to display the IP network configurations gathered by the previous cmdlets you ran.

```powershell
Get-NetIPConfiguration
```

![Getting IP network configurations](https://adamtheautomator.com/wp-content/uploads/2023/03/image-17.png)

Getting IP network configurations

> _The Get-NetIPConfiguration cmdlet is quicker if you only have one network interface. But if you have more than one network interface, you may have to filter out properties to prevent the console from scrolling._

## Configuring IP, Gateway, and DNS Address Manually

With the cmdlets you have learned so far, it is time to put your new knowledge to work. For this tutorial, you will assign a static IP address, gateway, and DNS servers to a Windows Server 2022 host.

> _The commands from this point forward only change the IP address, gateway, and DNS settings for the specified network adapter. You must repeat these steps for each adapter you want to change._

1\. Open [PowerShell as administrator,](https://adamtheautomator.com/powershell-run-as-administrator/) and run the following command to list the network adapters on your server.

Related:[Discover How to Run PowerShell as Administrator](https://adamtheautomator.com/powershell-run-as-administrator/)

```powershell
Get-NetAdapter
```

Find installed network adapters command

Identify the network adapter that you want to change. You can use the adapter’s name or the index number displayed in the list (i.e., Ethernet).

![Current network adapter properties of all installed adapters](https://adamtheautomator.com/wp-content/uploads/2023/03/image-18.png)

Current network adapter properties of all installed adapters

2\. Next, run the below [`Net-NetIPAddress`](https://learn.microsoft.com/en-us/powershell/module/nettcpip/new-netipaddress?view=windowsserver2022-ps) command to change the IPv4 address of your network adapter. The `-PrefixLength` of `24` shows that it used the first 24 bits of the IP address for the network portion of the address. Be sure to replace the following accordingly:

*   `AdapterName` – The name or index number of your target network adapter.
*   `ServerAddress` – The IPv4 address to add to the network adapter.
*   `GatewayAddress` – The gateway address should be in the same subnet as the IPv4 address.

```powershell
New-NetIPAddress -InterfaceAlias "[AdapterName]" -IPAddress [ServerAddress] -PrefixLength 24 -DefaultGateway [GatewayAddress]
```

![Setting a new IP address and gateway](https://adamtheautomator.com/wp-content/uploads/2023/03/image-19.png)

Setting a new IP address and gateway

> _Related to the New-NetIPAddress cmdlet is_ [Set-NetIPAddress](https://learn.microsoft.com/en-us/powershell/module/nettcpip/set-netipaddress?view=windowsserver2022-ps)_, which changes existing IP configuration, while_ [Remove-NetIPAddress](https://learn.microsoft.com/en-us/powershell/module/nettcpip/remove-netipaddress?view=windowsserver2022-ps) _expunges a configuration._

3\. Now, run the following [`Set-DnsClientServerAddress`](http://%3Chttps://learn.microsoft.com/en-us/powershell/module/dnsclient/set-dnsclientserveraddress?view=windowsserver2022-ps) command, which does not produce output, but changes the DNS servers. Ensure you replace `AdapterName` with your network adapter’s name (`-InterfaceAlias`) or index number (`-InterfaceIndex`). This command sets the DNS servers for your network adapter to Google’s public DNS servers at `8.8.8.8` and `8.8.4.4`. But you can specify any valid DNS server IP addresses you want.

```powershell
Set-DnsClientServerAddress -InterfaceAlias "[AdapterName]" -ServerAddresses 8.8.8.8, 8.8.4.4
```

> _Note that with the Set-DnsClientServerAddress cmdlet, you can assign one or more internal or public-facing DNS IP addresses._

4\. Lastly, run the below [`Restart-NetAdapter`](https://learn.microsoft.com/en-us/powershell/module/netadapter/restart-netadapter?view=windowsserver2022-ps%3E) command, which does not print output to the console but restarts your network adapter and applies the changes. Congratulations! You have just manually configured your network interface with a custom configuration.

```powershell
Restart-NetAdapter -Name Ethernet
```

> _If your host only has one adapter, like in this tutorial, you may lose connectivity briefly, depending on how you are connected. This last step is essential to complete to start using the new IP address._

## Conclusion

Knowing your network configuration is crucial to keeping a healthy network. The good news is that you learned about four basic network configuration commands available from PowerShell IP configuration cmdlets.

With this newfound knowledge, you can easily create a script using PowerShell IP configuration abilities as part of a broader server configuration process.

What comes next? Why not try adjusting more advanced options like MTU, adding more routes, or resetting an adapter to use DHCP instead of a static address?

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fpowershell-ip-configuration%2F&text=PowerShell%20IP%20Configuration%3A%20A%20Beginner%E2%80%99s%20Guide%20to%20Windows%20Settings)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fpowershell-ip-configuration%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fpowershell-ip-configuration%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2026/06/26995-troubleshoot-dns-issues-powershell-codex.webp)

### [Troubleshoot DNS Issues with PowerShell](/troubleshoot-dns-issues-powershell/)

Troubleshoot DNS issues with PowerShell by testing name resolution, DNS client settings, cache entries, and network connectivity in a repeatable workflow.

![](https://adamtheautomator.com/wp-content/uploads/2022/12/powershell-get-windows-version.jpg)

### [Learn the Many Ways in PowerShell to Get The Windows Version](/powershell-to-get-the-windows-version/)

Stay informed and learn the many ways in PowerShell to Get the Windows Version through examples in this ATA Learning tutorial!

![](https://adamtheautomator.com/wp-content/uploads/2021/10/photo-1530133532239-eda6f53fcf0f.jpg)

### [How to Disable IPv6 on Windows](/disable-ipv6/)

If you don’t plan on using IPv6 any time soon, learn how to disable IPv6 in Windows in this step-by-step tutorial.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
