Enabling Network IO Control (NIOC) through PowerCLI

Here's a short one.  One of my customers is using the VMware Distributed vSwitch in multiple vCenter inventories.  Since each vCenter maintains its own instance of the vSwitch, I was tasked with putting together an easy and repeatable process to create identically configured vSwitches across all of these environments.  In other words, I was asked for a script!  Most of the process is very well documented online, but there was one aspect of the config that was a struggle: enabling NIOC via PowerCLI.  It's a simple checkbox in the GUI, but near as I can tell, there was no simple way to enable it in a PowerShell script.

Like so often in life, LucD has the answer.  This specific nugget of information is a bit buried, so I figured that I'd put together a quick note expanding on it.  There's an API method, EnableNetworkResourceManagement(), that can toggle that setting for the DVS, but that method doesn't exist under the normal PowerCLI DVS object.  So, how do you access it?  Get-View.  By passing the DVS object to Get-View, you can call the full range of API methods for it.  In this case, it can be easily turned on by this command:

(get-vdswitch <Switch Name> | get-view).EnableNetworkResourceManagement($true)

And if you're looking to turn it off:

(get-vdswitch <Switch Name> | get-view).EnableNetworkResourceManagement($false)


Popular posts from this blog

Deleting Orphaned (AKA Zombie) VMDK Files

Clone a Standard vSwitch from one ESXi Host to Another

Orphaned VMDK Files