PowerShell Logo Small

Set-NetIPAddress



This is the built-in help made by Microsoft for the command 'Set-NetIPAddress', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Modifies IP address configuration properties of an existing IP address.

SYNTAX


Set-NetIPAddress [[-IPAddress] <String[]>] [-AddressFamily <AddressFamily[]>] [-AddressState <AddressState[]>] [-AsJob [<SwitchParameter>]]
[-CimSession <CimSession[]>] [-InterfaceAlias <String[]>] [-InterfaceIndex <UInt32[]>] [-PassThru [<SwitchParameter>]] [-PolicyStore <String>]
[-PreferredLifetime <TimeSpan>] [-PrefixLength <Byte>] [-PrefixOrigin <PrefixOrigin[]>] [-SkipAsSource <Boolean>] [-ThrottleLimit <Int32>]
[-Type <Type[]>] [-ValidLifetime <TimeSpan>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]
Set-NetIPAddress [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-PassThru [<SwitchParameter>]] [-PreferredLifetime <TimeSpan>]
[-PrefixLength <Byte>] [-SkipAsSource <Boolean>] [-ThrottleLimit <Int32>] [-ValidLifetime <TimeSpan>] -InputObject <CimInstance[]> [-Confirm
[<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Set-NetIPAddress cmdlet modifies IP address configuration properties of an existing IP address. This cmdlet has 2 types of parameters. One
set of parameters identifies the NetIPAddress object to be modified. These properties require that you use a IPv4 (or IPv6) address as an
identifier and you may include additional properties such as InterfaceIndex. The second set of parameters enables you to set specific
properties. These properties include Type, PrefixLength, valid or preferred lifetime and skip as source.


Note: IPAddress objects do not allow the IPv4 address or IPv6 address property to be modified after creation. To create a new IPv6 address or
IPv6 address, the New-NetIPAddress cmdlet must be used.



<

RELATED LINKS

New-TimeSpan
Get-NetIPAddress
New-NetIPAddress
Remove-NetIPAddress

REMARKS

<

Examples


EXAMPLE 1

PS C:\>New-NetIPAddress –InterfaceIndex 12 –IPAddress 192.168.0.1


Note: The PrefixLength parameter may also be specified as part of the New-NetIPAddress cmdlet.
PS C:\>Set-NetIPAddress –InterfaceIndex 12 –IPAddress 192.168.0.1 –PrefixLength 24



This example adds a new IP address, and uses this cmdlet to change the prefix length.




EXAMPLE 2

PS C:\>$timesp = ( New-TimeSpan –Days 1 )



PS C:\>Set-NetIPAddress –InterfaceIndex 12 –IPAddress 192.168.0.1 –PreferredLifetime $timesp



This example modifies an IP address, setting the ValidLifetime parameter to one day.