Export (0) Print
Expand All
Expand Minimize

Remove-IpamSubnet

Windows Server 2012 R2 and Windows 8.1

Updated: December 18, 2013

Applies To: Windows 8.1, Windows PowerShell 4.0, Windows Server 2012 R2

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

Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete. The cmdlet immediately returns an object that represents the job and then displays the command prompt. You can continue to work in the session while the job completes. To manage the job, use the *-Job cmdlets. To get the job results, use the Receive-Job cmdlet. For more information about Windows PowerShell® background jobs, see about_Jobs.


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.

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
Confirm

Deleting the non-virtualized subnet Contoso_2 with network 10.12.0.0/16.

[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y

Remove-IpamSubnet : There are ranges associated with this subnet.

At line:1 char:1

+ Remove-IpamSubnet -InputObject $subnet

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : ResourceUnavailable: (MSFT_IPAM_Subnet (InstanceID = "86-2"):ROOT/microsoft/ipam/MSFT_IP

AM_Subnet) [Remove-IpamSubnet], CimException

+ FullyQualifiedErrorId : WIN32 8,Remove-IpamSubnet

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
Confirm

Deleting the non-virtualized subnet Contoso_2 with network 10.12.0.0/16. Ranges mapped to this subnet will also be

deleted.

[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):Y

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
Confirm

Deleting the non-virtualized subnet Contoso_2 with network 10.12.0.0/16. Ranges mapped to this subnet and IP Addresses

associated via Ranges with this Subnet will also be deleted.

[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):Y

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
Confirm

Deleting the fabric subnet Contoso_3 with network 10.13.0.0/16. Ranges mapped to this subnet will also be deleted.

[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):Y

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
Confirm

Deleting the virtual subnet Contoso_1 with network 10.11.8.0/24. Ranges mapped to this subnet will also be deleted.

[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):Y

Related topics

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft