Remove-IpamSubnet

Remove-IpamSubnet

Removes a subnet from IPAM.

Syntax

Parameter Set: Query (cdxml)
Remove-IpamSubnet -NetworkId <String[]> [-AddressSpace <String[]> ] [-AsJob] [-CimSession <CimSession[]> ] [-DeleteAssociatedAddresses] [-DeleteAssociatedRanges] [-Force] [-NetworkType <VirtualizationType[]> ] [-PassThru] [-ThrottleLimit <Int32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: InputObject (cdxml)
Remove-IpamSubnet -InputObject <CimInstance[]> [-AsJob] [-CimSession <CimSession[]> ] [-DeleteAssociatedAddresses] [-DeleteAssociatedRanges] [-Force] [-PassThru] [-ThrottleLimit <Int32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Remove-IpamSubnet cmdlet removes a given subnet from IP Address Management (IPAM). By default, the cmdlet returns an error if there are ranges associated with the subnet. You can use the DeleteAssociatedRanges parameter to delete the associated ranges. You can specify the DeleteAssociatedAddresses parameter to delete the associated IP Addresses.

Parameters

-AddressSpace<String[]>

Specifies an array of names of address spaces. If you not specify an address space, the cmdlet removes all address spaces configured in IPAM.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

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

Session

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DeleteAssociatedAddresses

Indicates that the cmdlet deletes the addresses associated with these ranges.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DeleteAssociatedRanges

Indicates that the cmdlet deletes subnets and any associated ranges. If you do not specify this parameter, the cmdlet generates an error when there are ranges associated with the subnet.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Force

Forces the command to run without asking for user confirmation.

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

-NetworkId<String[]>

Specifies an array of networks for the subnets to remove.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-NetworkType<VirtualizationType[]>

Specifies an array of network types for the subnets to delete. The acceptable values for this parameter are:

-- Provider
-- Customer
-- NonVirtualized

If you do not specify a value, all matching IP subnets of network type Provider, Customer and NonVirtualized will be deleted.

Aliases

none

Required?

false

Position?

named

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

-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

-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.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • IpamSubnet

    Represents the subnet deleted from IPAM Server.

Examples

Example 1 Remove a non-virtualized subnet with a mapped range

This command removes a NonVirtualized subnet with a mapped range. An error occurs because a subnet cannot be deleted if there are ranges mapped to it

PS C:\> Remove-IpamSubnet -NetworkId 10.12.0.0/16 -NetworkType NonVirtualized

Example 2: Remove a non-virtualized subnet

This command removes a NonVirtualized subnet along with any ranges that are mapped to it. The cmdlet moves the mapped IP addresses to unmapped address space.

PS C:\> Remove-IpamSubnet -NetworkId 10.12.0.0/16 -NetworkType NonVirtualized -DeleteAssociatedRanges

Example 3: Remove a non-virtualized subnet

This command removes a NonVirtualized subnet along with ranges that map to it. Also remove any IP addresses that map to this subnet via the ranges that map to this subnet.

PS C:\> Remove-IpamSubnet -NetworkId 10.12.0.0/16 -NetworkType NonVirtualized -DeleteAssociatedRanges -DeleteAssociatedAddresses

Example 4: Remove a subnet for a provider network type

This command removes a subnet for a provider network type from the default address space.

PS C:\> Remove-IpamSubnet -NetworkId 10.13.0.0/16 -NetworkType Provider -AddressSpace Default -DeleteAssociatedRanges

Example 5: Remove a subnet for a customer network type

This command removes a subnet for a customer network type from the customer address space named Contoso.

PS C:\> Remove-IpamSubnet -NetworkId 10.11.8.0/24 -NetworkType Customer -AddressSpace Contoso -DeleteAssociatedRanges

Add-IpamSubnet

Export-IpamSubnet

Get-IpamSubnet

Import-IpamSubnet

Set-IpamSubnet