Working with disk limits in PowerCLI

This will be a post following on the previous one on how to control disk i/o in vSphere

That post showed how you set IOPS limits either through the UI or with PowerCLI.

Even though you set the limit on individual disks you need to work through the VM. And when you retrieve the disk limits for a VM you’ll get back limits on disks identified by the device key and not the label.

To make this a bit easier to work with I’ve created some Powershell functions that wraps the *-VMResourceConfiguration cmdlets and one that gives you the label of the disks when you query the limits for a VM.

First of is the Get-VMDiskLimit which is essentially a wrapper for this command:

It will output the limit of a disk in this way


We also have a function for setting limit on a disk which wraps this command

Note that this is outputting the disk in the default format (with the key), but we can easily add the last line from the command shown above to have the same output


Finally we have the function which will map the keys of the DiskResourceConfiguration output to the disk label names. This is done by mapping the key to the ExtensionData.Key property of the disks. We’ll iterate over all disks for the VM and create a custom object which we add to an array which we finally output from the function.

The function works by specifying a VM name and outputs in this format. Note that it supports multiple vms


All functions can be found on GitHub.



Working with Cloud Infrastructure @ Intility, Oslo Norway. Mainly focused on automating Datacenter stuff. All posts are personal

Leave a Reply

Your email address will not be published. Required fields are marked *