Set-NetIPAddress cmdlet

Spread the words

The Set-NetIPAddress cmdlet modifies IP address configuration properties of an existing IP address.


  • AddressFamily (IPv4, IPv6)

The cmdlet modifies the IP address configuration that matches the families.

  • AddressState (Invalid, Tentative, Duplicate, Deprecated, Preferred)
  • CimSession

This parameter runs the cmdlet in a remote session or on a remote computer.

  • IncludeAllCompartments

The cmdlet includes addresses from all configured network compartments.

  • InterfaceAlias

The cmdlet modifies IP addresses that match the aliases.

  • InterfaceIndex

The cmdlet modifies IP addresses that match the indexes.

  • IPAddress

The cmdlet specifies the IP address.

  • PassThru

The cmdlet returns an object representing the item with which you are working.

  • PolicyStore (ActiveStore, PersistentStore)
  • PreferredLifetime
  • PrefixLength

This parameter defines the local subnet size, and is also known as a subnet mask.

  • PrefixOrigine
  • SkipAsSource

This parameter identifies the primary IP address for outgoing traffic in a multiple IP address scenario.

  • SuffixOrigin (Manuel, WellKnown, DHCP, Link, Random)
  • ThrottleLimit
  • Type (Unicast, Anycast)
  • ValidLifetime
  • Confirm

This parameter prompts you for confirmation before running the cmdlet.

  • WhatIf

It shows what would happen if the cmdlet runs.


The input type is the type of the objects that you can pipe to the cmdlet.



 This command adds the IP address to the interface located at index 12.

Set-NetIPAddress –InterfaceIndex 12 –IPAddress

With netmask

Set-NetIPAddress –InterfaceIndex 12 –IPAddress –PrefixLength 24

 The first command creates a new TimeSpan object of one day, and stores it in the variable named $Timesp.

The second command then uses the TimeSpan object to set the preferred lifetime of the IP address located at interface 12 to one day.

$Timesp = ( New-TimeSpan –Days 1 )

Set-NetIPAddress –InterfaceIndex 12 –IPAddress –PreferredLifetime $Timesp

Be the first to comment on "Set-NetIPAddress cmdlet"

Leave a comment

Your email address will not be published.