vmware-archive / powernsx

PowerShell module that abstracts the VMware NSX-v API to a set of easily used PowerShell functions
173 stars 89 forks source link

Remove-NsxEdgeStaticRoute #580

Closed officialh1 closed 5 years ago

officialh1 commented 5 years ago

get-nsxEdge | Get-NsxEdgeRouting | Remove-NsxEdgeStaticRoute Should remove all static routes from all edge routers, but it fails with this error:

`Remove-NsxEdgeStaticRoute : Cannot validate argument on parameter 'StaticRoute'. XML Element specified does not contain a type property. At line:1 char:36

Obviously something like this would fail as well:

get-nsxEdge | Get-NsxEdgeRouting | Where {$_.staticrouting.staticroutes.route.network -eq "0.0.0.0/0"} | Remove-NsxEdgeStaticRoute

alagoutte commented 5 years ago

Hi,

From Remove-NSxEdgeSatticRoute example, missing a Get-NsxEdgeStaticRoute

    .EXAMPLE
    Remove all routes to 1.1.1.0/24 from ESG Edge01
    PS C:\> Get-NsxEdge Edge01 | Get-NsxEdgeRouting | Get-NsxEdgeStaticRoute | where-object { $_.network -eq '1.1.1.0/24' } | Remove-NsxEdgeStaticRoute
officialh1 commented 5 years ago

Oops, forgot a layer.