PowerCLI

 View Only
  • 1.  Automating Storage DRS (SDRS) Anti-Affinity Rules with PowerCLI

    Posted 30 days ago
    Hi everyone,
    After spending a few days researching how to automate Storage DRS (SDRS) VM anti-affinity rules, I noticed a complete gap in native PowerCLI cmdlets (like New-DrsRule which only handles compute), pyVmomi tools, or dedicated APIs for this lifecycle management. [1]
    It turns out the only way to build an SDRS rule is by manually instantiating PowerShell nested object actions to match what the lower-level vSphere API expects.
    I put together a quick script breaking down this "nesting doll" object architecture and how to map it to your datastore clusters. You can check out the full code and logic on my blog post: Creating Storage DRS VM Anti-Affinity Rules via PowerCLI.


  • 2.  RE: Automating Storage DRS (SDRS) Anti-Affinity Rules with PowerCLI

    Posted 29 days ago
    Edited by ITSavant 29 days ago
      |   view attached

    Nice, thanks. 
    While on the topic here's a function I wrote called "Set-DatastoreClusterPlus" to do all the stuff they forgot to add in PowerCli, not sure if it's still helpful, I've been mostly away from VMware since Broadcom, but maybe it will help someone.



    Attachment(s)



  • 3.  RE: Automating Storage DRS (SDRS) Anti-Affinity Rules with PowerCLI

    Posted 26 days ago

    Thanks for sharing this. The lack of native PowerCLI support for Storage DRS anti-affinity rules has been a challenge, and your guide does a great job explaining the required API object structure and automation process.

    This will be a helpful reference for VMware admins looking to automate SDRS rule management and avoid manual configuration.