How to configure Storage DRS clusters w/PowerCLi – Part 1


Despite the growing popularity of VMware VSAN, largest enterprises are still partially or completely continue to work with shared storage.

There are enough PowerCLi cmdlets to deal with HA/DRS cluster aspects, but for SDRS clusters the choice is not great.

gcm -Module vmware* -Noun *drs*
gcm -Module vmware* -Noun *datastorecluster*

This time we will look at just two functions Set-SdrsCluster/Get-SdrsCluster. These functions will complement the missing functionality of the built-in Set-DatastoreCluster/Get-DatastoreCluster functions respectively.


  • The Set-SdrsCluster function from my PowerCLi Vi-Module module completely covers all the existing configuration settings of SDRS clusters.


  • The function can take one or more SDRS clusters in the -DatastoreCluster parameter. Supported also passing objects through the pipeline.
Set-SdrsCluster -DatastoreCluster (Get-DatastoreCluster)
Get-DatastoreCluster | Set-SdrsCluster



  • The Set-SdrsCluster uses five ParameterSets – three simple (one parameter only per set) and two complex (more than one parameter per set).

Simple ParameterSets

  • Set Default VM affinity. The –DefaultIntraVmAffinity parameter.
Get-DatastoreCluster $DatastoreClusterName | Set-SdrsCluster –DefaultIntraVmAffinity DistributeAcrossDatastores
Get-DatastoreCluster $DatastoreClusterName | Set-SdrsCluster –DefaultIntraVmAffinity KeepTogether


  • Turn ON/OFF vSphere Storage DRS. The –TurnOnSDRS parameter.
Get-DatastoreCluster $DatastoreClusterName | Set-SdrsCluster –TurnOnSDRS:$true
Get-DatastoreCluster $DatastoreClusterName | Set-SdrsCluster –TurnOnSDRS:$false


  • Set Storage DRS Automation level. The –AutomationLevel parameter.
Get-DatastoreCluster $DatastoreClusterName | Set-SdrsCluster –AutomationLevel FullyAutomated
Get-DatastoreCluster $DatastoreClusterName | Set-SdrsCluster –AutomationLevel ManualMode


Complex ParameterSets

  • Set SDRS Runtime Rules that include: I/O Metrics, Thresholds and Advanced Options.
Get-DatastoreCluster $DatastoreClusterName | Set-SdrsCluster –EnableIOMetric:$true


  • Only –EnableIOMetric parameter is mandatory. The remaining five parameters have default values.
  • It is important to understand here that all six settings or parameters will be applied, regardless of whether you specify them or not!
Get-DatastoreCluster $DatastoreClusterName | Set-SdrsCluster –EnableIOMetric:$true -UtilizedSpace 90 –IOLatency 10 –MinSpaceUtilizationDifference 20 –CheckImbalanceEveryMin 43200 –IOImbalanceThreshold 20
  • The parameter names and their default values are summarized in the following table.
Parameter Default Units
-EnableIOMetric Mandatory $true/$false
-UtilizedSpace 80 % (from 50 to 100)
-IOLatency 15 Millisecond (from 5 to 100)
-MinSpaceUtilizationDifference 5 % (from 1 to 50)
-CheckImbalanceEveryMin 480 Minute (from 60 to 43200)
-IOImbalanceThreshold 5 Conditional scale (from 1 to 25)
  • Set Configuration Parameters. Parameters pair –Option/–Value.
Get-DatastoreCluster $DatastoreClusterName | Set-SdrsCluster –Option $Option –Value $Value
Get-DatastoreCluster | Set-SdrsCluster -Option IgnoreAffinityRulesForMaintenance -Value 1


  • This aspect of the SDRS is little documented, I recommend this article for reference. I personally use the IgnoreAffinityRulesForMaintenance setting only.

The -ShowBeforeState switch

  • This parameter always can be used. By default, the Set-SdrsCluster calls the Get-SdrsCluster function at the end of configuring. If you prefer to preview current cluster settings (before you actually make changes) just add -ShowBeforeState parameter.
Get-DatastoreCluster | Set-SdrsCluster -ShowBeforeState –AutomationLevel FullyAutomated
Get-DatastoreCluster | Set-SdrsCluster -ShowBeforeState –EnableIOMetric:$true
Get-DatastoreCluster | Set-SdrsCluster -ShowBeforeState -Option IgnoreAffinityRulesForMaintenance -Value 1



  • This simple function has only one parameter and that one is optional.

Overall SDRS cluster settings

  • With no parameters Get-SdrsCluster returns overall SDRS cluster configuration. Something like Get-DatastoreCluster, but more funny Emoj.
Get-DatastoreCluster | Get-SdrsCluster
Get-DatastoreCluster -Location $DatacenterName | Get-SdrsCluster
Get-Datacenter $DatacenterName | Get-DatastoreCluster PROD* | Get-SdrsCluster
  • The function utilizes auxiliary function New-PercentageBar to represent some properties graphically.

VM Overrides

  • To get VM related overrides, just use –VMOverrides or –VMSettings parameter. The -VMSettings is just alias of -VMOverrides.


Get-DatastoreCluster | Get-SdrsCluster –VMOverrides
Get-DatastoreCluster | Get-SdrsCluster -VMSettings


  • Note the Source property, similar information is not present in the UI. In fact, VM overrides’ source can be not only override itself, but also so-called VMDK Anti-Affinity Rule.



  • For more details about the functions, please take a look at the content based help and examples.
Get-Help Set-SdrsCluster -Full
Get-Help Get-SdrsCluster -Examples
Get-Help Set-SdrsCluster -Parameter IOLatency

Part 2 >>

You may also like:

Get-RDM – How to get RDM (Raw Device Mappings) disks
Search-Datastore – Browse/Search VMware Datastores
Copy VMware VM Notes to Computer/AD Computer Description
Move-Template2Datastore – Migrate VMware VM Templates to another Datastore

2 thoughts on “How to configure Storage DRS clusters w/PowerCLi – Part 1

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s