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

Misc: Navien NPE-240A Navilink App missing scheduling function

Macbook Pro OSX 10.5.x Sprint Blackberry 8830 Data Tethering

Misc: Fire TV Stick 2 Screen Cut Off, no display adjustment option