< Back
New-NetIPAddress
Post
NAME New-NetIPAddress
SYNOPSIS
Creates and configures an IP address.
SYNTAX
New-NetIPAddress [-IPAddress] <String> [-AddressFamily {IPv4 | IPv6}] [-CimSession <CimSession[]>] [-DefaultGateway <String>] [-PolicyStore
<String>] [-PreferredLifetime <TimeSpan>] [-PrefixLength <Byte>] [-SkipAsSource <Boolean>] [-ThrottleLimit <Int32>] [-Type {Unicast | Anycast}]
[-ValidLifetime <TimeSpan>] -InterfaceAlias <String> [-Confirm] [-WhatIf] [<CommonParameters>]
New-NetIPAddress [-IPAddress] <String> [-AddressFamily {IPv4 | IPv6}] [-CimSession <CimSession[]>] [-DefaultGateway <String>] [-PolicyStore
<String>] [-PreferredLifetime <TimeSpan>] [-PrefixLength <Byte>] [-SkipAsSource <Boolean>] [-ThrottleLimit <Int32>] [-Type {Unicast | Anycast}]
[-ValidLifetime <TimeSpan>] -InterfaceIndex <UInt32> [-Confirm] [-WhatIf] [<CommonParameters>]
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. If Duplicate
Address Detection (DAD) is enabled on the interface, the new IP address is not usable until DAD successfully finishes, which confirms the
uniqueness of the IP address on the link.
PARAMETERS
-AddressFamily [<AddressFamily>]
Specifies an IP address family. The cmdlet creates an IP address for the family. If you do not specify this parameter, the property is
automatically generated. The acceptable values for this parameter are:
-- IPv4
-- IPv6
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-CimSession [<CimSession[]>]
Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession
or Get-CimSession cmdlet. The default is the current session on the local computer.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-DefaultGateway [<String>]
Specifies the IPv4 address or IPv6 address of the default gateway for the host. Default gateways provide a default route for TCP/IP hosts to
use when communicating with other hosts on remote networks.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-InterfaceAlias <String>
Specifies an alias of a network interface. The cmdlet creates an IP address for the alias.
Required? true
Position? named
Default value none
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-InterfaceIndex <UInt32>
Specifies an index of a network interface. The cmdlet creates an IP address for the index.
Required? true
Position? named
Default value none
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-IPAddress <String>
Specifies the IPv4 or IPv6 address to create.
Required? true
Position? 1
Default value none
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-PolicyStore [<String>]
Specifies a PolicyStore value. The acceptable values for this parameter are:
-- ActiveStore. The IP address information is valid.
-- PersistentStore. The computer saves IP address information across restarts. When the computer restarts, it copies the saved settings to
the ActiveStore.
The default value is ActiveStore. Specify ActiveStore only.
If you do not specify this parameter, the default entries are created in both the ActiveStore and the PersistentStore.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-PreferredLifetime [<TimeSpan>]
Specifies a preferred lifetime, as a TimeSpan object, for an IP address. To obtain a TimeSpan object, use the New-TimeSpan cmdlet.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-PrefixLength [<Byte>]
Specifies a prefix length. This parameter defines the local subnet size, and is also known as a subnet mask.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-SkipAsSource [<Boolean>]
Indicates whether an address is a primary IP address. This parameter identifies the primary IP address for outgoing traffic in a multiple IP
address scenario. If this parameter is set to True, the addresses are not used for outgoing traffic and are not registered in DNS.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-ThrottleLimit [<Int32>]
Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0
is entered, then Windows PowerShell???? calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running
on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-Type [<Type>]
Specifies an IP address type. The acceptable values for this parameter are:
-- Unicast
-- Anycast
The default value is Unicast.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-ValidLifetime [<TimeSpan>]
Specifies a valid lifetime value, as a TimeSpan object, for an IP address. To obtain a TimeSpan object, use the New-TimeSpan cmdlet.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
None
OUTPUTS
Microsoft.Management.Infrastructure.CimInstance#root\\StandardCimv2\\MSFT_NetIPAddress
The Microsoft.Management.Infrastructure.CimInstance object is a wrapper class that displays Windows Management Instrumentation (WMI) objects.
The path after the pound sign (#) provides the namespace and class name for the underlying WMI object.
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.
RELATED LINKS
Online Version: http://go.microsoft.com/fwlink/?LinkId=288394
Get-NetIPAddress
Remove-NetIPAddress
Remove-NetRoute
Set-NetIPAddress
SYNOPSIS
Creates and configures an IP address.
SYNTAX
New-NetIPAddress [-IPAddress] <String> [-AddressFamily {IPv4 | IPv6}] [-CimSession <CimSession[]>] [-DefaultGateway <String>] [-PolicyStore
<String>] [-PreferredLifetime <TimeSpan>] [-PrefixLength <Byte>] [-SkipAsSource <Boolean>] [-ThrottleLimit <Int32>] [-Type {Unicast | Anycast}]
[-ValidLifetime <TimeSpan>] -InterfaceAlias <String> [-Confirm] [-WhatIf] [<CommonParameters>]
New-NetIPAddress [-IPAddress] <String> [-AddressFamily {IPv4 | IPv6}] [-CimSession <CimSession[]>] [-DefaultGateway <String>] [-PolicyStore
<String>] [-PreferredLifetime <TimeSpan>] [-PrefixLength <Byte>] [-SkipAsSource <Boolean>] [-ThrottleLimit <Int32>] [-Type {Unicast | Anycast}]
[-ValidLifetime <TimeSpan>] -InterfaceIndex <UInt32> [-Confirm] [-WhatIf] [<CommonParameters>]
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. If Duplicate
Address Detection (DAD) is enabled on the interface, the new IP address is not usable until DAD successfully finishes, which confirms the
uniqueness of the IP address on the link.
PARAMETERS
-AddressFamily [<AddressFamily>]
Specifies an IP address family. The cmdlet creates an IP address for the family. If you do not specify this parameter, the property is
automatically generated. The acceptable values for this parameter are:
-- IPv4
-- IPv6
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-CimSession [<CimSession[]>]
Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession
or Get-CimSession cmdlet. The default is the current session on the local computer.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-DefaultGateway [<String>]
Specifies the IPv4 address or IPv6 address of the default gateway for the host. Default gateways provide a default route for TCP/IP hosts to
use when communicating with other hosts on remote networks.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-InterfaceAlias <String>
Specifies an alias of a network interface. The cmdlet creates an IP address for the alias.
Required? true
Position? named
Default value none
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-InterfaceIndex <UInt32>
Specifies an index of a network interface. The cmdlet creates an IP address for the index.
Required? true
Position? named
Default value none
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-IPAddress <String>
Specifies the IPv4 or IPv6 address to create.
Required? true
Position? 1
Default value none
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-PolicyStore [<String>]
Specifies a PolicyStore value. The acceptable values for this parameter are:
-- ActiveStore. The IP address information is valid.
-- PersistentStore. The computer saves IP address information across restarts. When the computer restarts, it copies the saved settings to
the ActiveStore.
The default value is ActiveStore. Specify ActiveStore only.
If you do not specify this parameter, the default entries are created in both the ActiveStore and the PersistentStore.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-PreferredLifetime [<TimeSpan>]
Specifies a preferred lifetime, as a TimeSpan object, for an IP address. To obtain a TimeSpan object, use the New-TimeSpan cmdlet.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-PrefixLength [<Byte>]
Specifies a prefix length. This parameter defines the local subnet size, and is also known as a subnet mask.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-SkipAsSource [<Boolean>]
Indicates whether an address is a primary IP address. This parameter identifies the primary IP address for outgoing traffic in a multiple IP
address scenario. If this parameter is set to True, the addresses are not used for outgoing traffic and are not registered in DNS.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-ThrottleLimit [<Int32>]
Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0
is entered, then Windows PowerShell???? calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running
on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-Type [<Type>]
Specifies an IP address type. The acceptable values for this parameter are:
-- Unicast
-- Anycast
The default value is Unicast.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-ValidLifetime [<TimeSpan>]
Specifies a valid lifetime value, as a TimeSpan object, for an IP address. To obtain a TimeSpan object, use the New-TimeSpan cmdlet.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
None
OUTPUTS
Microsoft.Management.Infrastructure.CimInstance#root\\StandardCimv2\\MSFT_NetIPAddress
The Microsoft.Management.Infrastructure.CimInstance object is a wrapper class that displays Windows Management Instrumentation (WMI) objects.
The path after the pound sign (#) provides the namespace and class name for the underlying WMI object.
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.
RELATED LINKS
Online Version: http://go.microsoft.com/fwlink/?LinkId=288394
Get-NetIPAddress
Remove-NetIPAddress
Remove-NetRoute
Set-NetIPAddress