PowerShell Logo Small

New-NetIPAddress



This is the built-in help made by Microsoft for the command 'New-NetIPAddress', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 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 and configures an IP address.

SYNTAX


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



Search powershellhelp.space

DESCRIPTION


The New-NetIPAddress cmdlet creates and configures an IP address. To create a specific IP address object, specify either an IPv4 address or an IPv6 address, and an interface
index or interface alias. We recommend that you define the prefix length, also known as a subnet mask, and a default gateway.


If you run this cmdlet to add an IP address to an interface on which DHCP is already enabled, then DHCP is automatically disabled.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkId=288394
Get-NetIPAddress
Remove-NetIPAddress
Remove-NetRoute
Set-NetIPAddress

REMARKS

<

Examples


Example 1: Add an IPv4 address

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


The second 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



The first command adds a new IPv4 address to the network interface at index 12. The PrefixLength parameter specifies the subnet mask for the IP address. In this example, the
PrefixLength of 24 equals 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 that you add.