Modify Bulk vApp Network Attachments

With vCloud Director if you need to change the Organization vDC Network, for instance you run out of IP addresses. You can use the script below to change the attached network of all powered off vApps.

1$vapps = search-cloud -QueryType VAppOrgNetworkRelation | Where-Object { $_.OrgNetworkName -eq "Old Network Name" -and $_.Status -eq "Stopped” }
2foreach ($vapp in $vapps) {
3  get-civapp -id $vapp.id | Get-CIVAppNetwork -ErrorAction SilentlyContinue | Where-Object { $_.ConnectionType -eq "Routed" } | Set-CIVAppNetwork -ParentOrgNetwork "New Network Name"
4  Write-Host "Updated " $vapp.id " Owned by: " $Vapp.OwnerName
5}

Simply change the New Network Name and Old Network Name in the commands above.


Query vCloud Director for Storage Profile Usage
Detecting and Removing Invalid vApp Templates