Remove-NetIPAddress
Remove-NetIPAddress
Deletes an IP address and the configuration properties of that IP address.
Syntax
Parameter Set: Query (cdxml)
Remove-NetIPAddress [[-IPAddress] <String[]> ] [-AddressFamily <AddressFamily[]> ] [-AddressState <AddressState[]> ] [-AsJob] [-CimSession <CimSession[]> ] [-DefaultGateway <String> ] [-InterfaceAlias <String[]> ] [-InterfaceIndex <UInt32[]> ] [-PassThru] [-PolicyStore <String> ] [-PreferredLifetime <TimeSpan[]> ] [-PrefixLength <Byte[]> ] [-PrefixOrigin <PrefixOrigin[]> ] [-SkipAsSource <Boolean[]> ] [-SuffixOrigin <SuffixOrigin[]> ] [-ThrottleLimit <Int32> ] [-Type <Type[]> ] [-ValidLifetime <TimeSpan[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: InputObject (cdxml)
Remove-NetIPAddress -InputObject <CimInstance[]> [-AsJob] [-CimSession <CimSession[]> ] [-PassThru] [-ThrottleLimit <Int32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
Detailed Description
The Remove-NetIPAddress cmdlet deletes IP address and the configuration properties of that IP address. To remove a specific IP address object, be sure to use the IPv4 Address parameter or IPv6 Address parameter. Other parameters will remove all IP addresses with the matching property.
Parameters
-AddressFamily<AddressFamily[]>
Removes all IP addresses that have a specific IP address family. A read-only property. The acceptable values for this parameter are:
-- IPv4: IPv4 address information.
-- IPv6: IPv6 address information.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-AddressState<AddressState[]>
Removes all the IP addresses that have a specific duplicate address detection (DAD) state for an IPv4 and IPv6 address. A read-only property. The acceptable values for this parameter are:
-- Invalid: IP address configuration information for addresses that are not valid and will not be used.
-- Tentative: IP address configuration information for addresses that are not used for communication, as the uniqueness of those IP addresses is being verified.
-- Duplicate: IP address configuration information for addresses for which a duplicate IP address has been detected and the current IP address will not be used.
-- Deprecated: IP address configuration information for addresses that will no longer be used to establish new connections, but will continue to be used with existing connections.
-- Preferred: IP address configuration information for addresses that are valid and available for use.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-AsJob
Aliases |
none |
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.
Aliases |
none |
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 to use. Default gateways provide a default route for TCP/IP hosts to use when communicating with other hosts on remote networks.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-InputObject<CimInstance[]>
Specifies the input to this cmdlet. You can use this parameter, or you can pipe the input to this cmdlet.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-InterfaceAlias<String[]>
Removes all of the IP addresses that have a specific interface, as defined by the InterfaceAlias.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true (ByPropertyName) |
Accept Wildcard Characters? |
false |
-InterfaceIndex<UInt32[]>
Removes all of the IP addresses that have a specific interface, as defined by the InterfaceIndex number.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true (ByPropertyName) |
Accept Wildcard Characters? |
false |
-IPAddress<String[]>
Removes all of the IP addresses that have a specific IPv4 or IPv6 address.
Aliases |
none |
Required? |
false |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true (ByPropertyName) |
Accept Wildcard Characters? |
false |
-PassThru
Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-PolicyStore<String>
Specifies the PolicyStore value. The acceptable values for this parameter are:
-- ActiveStore: The IP address information is currently valid.
-- PersistentStore: The IP address information is persistent across reboots. When the computer starts, the PersistentStore settings are copied to the ActiveStore.
The default value is ActiveStore.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-PreferredLifetime<TimeSpan[]>
Removes all of the IP addresses that have a specific PreferredLifetime. PreferredLifetime uses time as defined by the TimeSpan structure.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-PrefixLength<Byte[]>
Identifies the IP address object by the PrefixLength. The PrefixLength defines the local subnet size, and is also known as a subnet mask.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-PrefixOrigin<PrefixOrigin[]>
Gets the IP address information for IP addresses that have a specific prefix origin. IP addresses are divided into two parts, the prefix and the suffix. The address prefix identifies the network portion of an IP address, and the address suffix identifies the host portion. The acceptable values for this parameter are:
-- Manual: The IP address prefix was manually specified.
-- WellKnown: The IP address prefix is from a well-known source.
-- DHCP: The IP address prefix was provided by DHCP settings.
-- RouterAdvertisement: The IP address prefix was obtained through a router advertisement (RA).
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-SkipAsSource<Boolean[]>
Removes all of the IP addresses that have a SkipAsSource flag to True or False. SkipAsSource is used in a multiple IP address scenario in which the only the primary IP address for outgoing traffic. The IP addresses that have SkipAsSource set to True are not used for outgoing traffic and are not registered in DNS.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-SuffixOrigin<SuffixOrigin[]>
Gets the IP address information for IP addresses that have a specific suffix origin. IP addresses are divided into two parts, the prefix and the suffix. The address prefix identifies the network portion of an IP address, and the address suffix identifies the host portion. The acceptable values for this parameter are:
-- Manual: The IP address prefix was manually specified.
-- WellKnown: The IP address suffix is from a well-known source.
-- DHCP: The IP address suffix was provided by DHCP settings.
-- Link: The IP address suffix was obtained from the link-layer address.
-- Random: The IP address suffix was obtained from a random source.
Aliases |
none |
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.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Type<Type[]>
Removes all of the IP addresses that have a specific type. The acceptable values for this parameter are:
-- Unicast: Marks the address as a unicast address.
-- Anycast: Marks the address as an anycast address.
The default value is Unicast.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-ValidLifetime<TimeSpan[]>
Removes all of the IP addresses that have a ValidLifetime. ValidLifetime uses time as defined by the TimeSpan structure.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Confirm
Prompts you for confirmation before running the cmdlet.
Required? |
false |
Position? |
named |
Default Value |
false |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-WhatIf
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, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
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.
Outputs
The output type is the type of the objects that the cmdlet emits.
- None
Examples
EXAMPLE 1
This example adds a new IP address.
PS C:\> New-NetIPAddress –InterfaceIndex 12 –IPAddress 192.168.0.1
The remove cmdlet then removes it.
PS C:\> Remove-NetIPAddress –IPAddress 192.168.0.1
EXAMPLE 2
This example provides an alternative method to EXAMPLE 1 that removes all of the IP addresses that have an IP address of 192.168.0.1.
PS C:\> Get-NetIPAddress –IPAddress 192.168.0.1 | Remove-NetIPAddress
EXAMPLE 3
This example removes all of the IP addresses that have a manually configured prefix origin.
PS C:\> Remove-NetIPAddress –PrefixOrigin Manual