Powershell: Changing NSX-T Segment Profiles enmasse.




Summary:
Note to self, cut back on the reddit.  It's a time suck and VMware questions are popping up that I have time to answer w/o the shadow of a retired LucD bot lurking.  Anyway, someone asked if you could update segment profiles, so I got curious and followed the rabbit.

Here is the example I came up with.  It's straight powershell core, so no special modules needed, not even vmware.powercli.  GASP!

Comments

Telmo said…
Thanks for the helpful script, however i'm having an issue when updating Mac discovery profiles. (everything else i've left default.

$TargetMacDPName = "Allow-MacDiscoveryProfile"

Result:

Invoke-RestMethod:
Line |
9 | Invoke-restmethod -Uri ($base_url + $binding.results.path) -M …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| {
"module_name" : "common-services",
"error_message" : "The requested URI: /api/v1 could not be found.",
"error_code" : 258
}

Invoke-RestMethod:
Line |
9 | Invoke-restmethod -Uri ($base_url + $binding.results.path) -M …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| {
"module_name" : "common-services",
"error_message" : "The requested URI: /api/v1 could not be found.",
"error_code" : 258
}
Zsoldier said…
Looks like your $base_url is empty and no results in $binding.results.path.

Popular posts from this blog

NSX-T: vCenter and NSX-T Inventory out of Sync (Hosts in vSphere not showing up in NSX-T)

MacOS: AnyConnect VPN client was unable to successfully verify the IP forwarding table modifications.

Azure VMware Solution: NSX-T Active/Active T0 Edges...but