PowerShell Logo Small

New-NetIPAddress



This is the built-in help made by Microsoft for the command 'New-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

Creates an IP address and the configuration properties of that IP address.

SYNTAX


New-NetIPAddress [-IPAddress] <String> [-AddressFamily <AddressFamily>] [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>]
[-DefaultGateway <String>] [-PolicyStore <String>] [-PreferredLifetime <TimeSpan>] [-PrefixLength <Byte>] [-SkipAsSource <Boolean>]
[-ThrottleLimit <Int32>] [-Type <Type>] [-ValidLifetime <TimeSpan>] -InterfaceAlias <String> [-Confirm [<SwitchParameter>]] [-WhatIf
[<SwitchParameter>]] [<CommonParameters>]
New-NetIPAddress [-IPAddress] <String> [-AddressFamily <AddressFamily>] [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>]
[-DefaultGateway <String>] [-PolicyStore <String>] [-PreferredLifetime <TimeSpan>] [-PrefixLength <Byte>] [-SkipAsSource <Boolean>]
[-ThrottleLimit <Int32>] [-Type <Type>] [-ValidLifetime <TimeSpan>] -InterfaceIndex <UInt32> [-Confirm [<SwitchParameter>]] [-WhatIf
[<SwitchParameter>]] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The New-NetIPAddress cmdlet creates IP address and the configuration properties of that IP address. To create a specific IP address object,
the required parameters include an IP address (IPv4 or IPv6) and an interface (InterfaceIndex or InterfaceAlias). It is also recommended to
define the prefix length, also known as a subnet mask, and default gateway.


If DHCP is enabled on the interface to which this cmdlet is configured to, then DHCP will automatically be disabled.


Note: The DefaultGateway parameter sets a route to make the new IP address reachable. The Remove-NetIPAddress cmdlet will also remove this
route provided the DefaultGateway parameter.



<

RELATED LINKS

Get-NetIPAddress
Remove-NetIPAddress
Remove-NetRoute
Set-NetIPAddress

REMARKS

<

Examples


EXAMPLE 1

PS C:\>New-NetIPAddress –InterfaceIndex 12 –IPAddress 192.168.0.1 -PrefixLength 24 -DefaultGateway 192.168.0.5


This command removes the IPv4 address. To remove the IPv4 address, use the Remove-NetIPAddress cmdlet.
PS C:\>Remove-NetIPAddress –IPAddress 192.168.0.1 -DefaultGateway 192.168.0.5



This command adds a new IPv4 address to the network interface at index 12. The subnet mask is determined by the PrefixLength parameter. In
this example, the PrefixLength of 24 is equivalent to a subnet mask of 255.255.255.0. When you add an IPv4 address, the address specified for
the Default Gateway must be in the same subnet as the IPv4 address you add.