Set NetIPInterface - PowerShell


The Set-NetIPInterface command modifies IP address, subnet, and other network-related configurations of network interfaces on a Windows system. It enables administrators to dynamically manage IP addresses and network settings to optimize network configurations, troubleshoot issues, or implement complex network architectures.


Set-NetIPInterface [-InterfaceAlias] <String> [-Index] <UInt32> [-Name] <String> 
[-NewAddress <String[]>] [-AddressFamily] <AddressFamily> [-Confirm] [-IPAddress] <String> 
[-InterfaceMetric] <UInt32> [-Netmask] <String> [-PrefixLength] <UInt32> 
[-DefaultGateway] <String> [-Dhcp] [-IPv6Address] <String[]> [-IPv6DefaultGateway] <String> 
[-IPv6PrefixLength] <UInt32> [-IPv6DadTransmits] <UInt32> [-IPv6PreferTemporaryAddresses] 
[-WhatIf] [-PassThru]


  • -InterfaceAlias: Specifies the alias of the network interface to modify.
  • -Index: Indicates the index number of the network interface.
  • -Name: Modifies the friendly name of the network interface.
  • -NewAddress: Adds one or more new IP addresses to the interface.
  • -AddressFamily: Selects the IP address family (IPv4 or IPv6) for the specified address.
  • -Confirm: Prompts for confirmation before执行ing the operation.
  • -IPAddress: Sets the IPv4 address for the interface.
  • -InterfaceMetric: Assigns a metric value to the interface for routing purposes.
  • -Netmask: Sets the subnet mask for the interface’s IPv4 address.
  • -PrefixLength: Specifies the prefix length for the interface’s IPv6 address.
  • -DefaultGateway: Sets the default gateway for the interface.
  • -Dhcp: Enables DHCP for the interface.
  • -IPv6Address: Adds one or more new IPv6 addresses to the interface.
  • -IPv6DefaultGateway: Sets the default gateway for the interface’s IPv6 addresses.
  • -IPv6PrefixLength: Sets the prefix length for the interface’s IPv6 address.
  • -IPv6DadTransmits: Configures the number of Neighbor Discovery Protocol (NDP) Duplicate Address Detection (DAD) transmissions.
  • -IPv6PreferTemporaryAddresses: Prefers temporary IPv6 addresses over permanent addresses.
  • -WhatIf: Displays the actions that would be performed without actually executing them.
  • -PassThru: Outputs an object representing the modified network interface.


1. Set a new IPv4 address:

Set-NetIPInterface -InterfaceAlias "Ethernet" -NewAddress "" -Netmask "" -DefaultGateway ""

2. Enable DHCP on an interface:

Set-NetIPInterface -InterfaceAlias "Wi-Fi" -Dhcp Enabled

3. Add an IPv6 address to an interface:

Set-NetIPInterface -InterfaceAlias "Ethernet" -IPv6Address "2001:db8:0:1::1" -IPv6PrefixLength 64

Common Issues

  • Ensure that the interface specified exists and is enabled.
  • Verify that the IP addresses and subnet masks are valid and do not conflict with other network devices.
  • Avoid setting default gateways for interfaces that do not require them (e.g., loopback interfaces).
  • Check for any firewall rules or other security measures that may block the new IP configuration.


Set-NetIPInterface can be used in conjunction with other PowerShell commands for advanced network management tasks, such as:

  • Get-NetIPInterface: Retrieve information about network interfaces.
  • Add-NetRoute: Add or modify routing entries.
  • Export-NetAdapterBinding: Export network adapter binding data for offline analysis.
  • New-NetIPInterface: Creates a new network interface.
  • Remove-NetIPInterface: Removes an existing network interface.
  • Enable-NetAdapter: Enables a disabled network adapter.
  • Disable-NetAdapter: Disables an enabled network adapter.