Deleting an organization at the Cloud Director level can sometimes be a challenging task, especially when there are networks associated with it. One of the common issues that users face is that they cannot remove the OrgVDC network even though all other objects belonging to the organization have been removed. This issue is often caused by the fact that the network is still in use by one or more vApps, making it impossible to delete it.
In this blog post, we will explore the reasons why you cannot delete an OrgVDC network that isn’t connected to anything and the solutions to resolve this issue. We will also provide a PowerShell script that can help you remove such networks easily.
Reasons for unable to delete OrgVDC network
—————————————–
There are two main reasons why you cannot delete an OrgVDC network that isn’t connected to anything:
### 1. Network is still in use by one or more vApps
When you try to delete an OrgVDC network, Cloud Director checks if there are any vApps or VMs using the network. If there are any, you will not be able to delete the network. This is because the network is still in use, and deleting it would cause disruptions to the vApps and VMs that rely on it.
### 2. Network has been designated as a default network for one or more organizations
If an OrgVDC network has been designated as a default network for one or more organizations, you will not be able to delete it until you remove the default designation. This is because the network is still in use by the organizations that rely on it as their default network.
Solutions to resolve unable to delete OrgVDC network issue
———————————————————
To resolve the issue of unable to delete an OrgVDC network, you can try the following solutions:
### 1. Remove all vApps and VMs using the network
If there are any vApps or VMs using the OrgVDC network, you will need to remove them before attempting to delete the network. This can be done by moving the vApps and VMs to another network or by deleting them altogether. Once all objects using the network have been removed, you should be able to delete the network successfully.
### 2. Remove the default designation of the OrgVDC network for the organizations that use it
If the OrgVDC network has been designated as a default network for one or more organizations, you will need to remove the default designation before attempting to delete the network. This can be done by going to the Organizations tab in Cloud Director and removing the default designation for each organization that uses the network. Once all default designations have been removed, you should be able to delete the network successfully.
PowerShell script for removing OrgVDC networks
———————————————
To make it easier to remove OrgVDC networks that aren’t connected to anything, we have developed a PowerShell script that can help you accomplish this task with ease. The script is based on the following PowerShell command:
“`powershell
Remove-CloudDirectorNetwork -Name
“`
Here’s how you can use the script to remove an OrgVDC network:
1. Open the PowerShell console on your Cloud Director server.
2. Type the following command and press Enter:
“`powershell
$networkName = “OrgVDC-Network-01”
Remove-CloudDirectorNetwork -Name $networkName -Force
“`
This will delete the OrgVDC network with the name `OrgVDC-Network-01` and all objects associated with it.
Conclusion
———-
In this blog post, we have discussed the reasons why you cannot delete an OrgVDC network that isn’t connected to anything and the solutions to resolve this issue. We have also provided a PowerShell script that can help you remove such networks easily. By following the steps outlined in this post, you should be able to delete the OrgVDC network and proceed with removing the organization.