Deleting SCVMM 2012 R2 Logical Network Definitions with PowerShell.

Attempting to delete a SCVMM 2012R2 logical network throws an exception as shown in the screen shot below because there are other dependencies like the Port Profiles, logical switches and other network objects still depending on it.

lognet1

The “View Dependent Resources” page displays the current Logical network definition dependencies preventing the Logical network from being removed.

lognet4

We can remove the network definitions with PowerShell after which we delete the logical network.

lognet2

Get-SCLogicalNetworkDefinition -LogicalNetwork "Test Logical Network" | Remove-SCLogicalNetworkDefinition -Verbose

The PowerShell script gets the specified Logical network definition for the specified LogicalNetwork parameter and pipes the result to the Remove-SCLogicalNetworkDefinition

In the next script, we use the Get-SCLogicalNetwork to retrieve the specified Logical network and pipe the result to the Remove-SCLogicalNetwork

Get-SCLogicalNetwork -Name "Test Logical Network" | Remove-SCLogicalNetwork -Verbose

lognet3

Running the Get-SCLogicalNetwork -Name "Test Logical Network" doesn’t return any value. This confirms the removal was successful.

Advertisements
This entry was posted in SCVMM2012R2, System Center 2012 R2, VMM2012R2, Windows Server 2012 R2 and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s