PowerCLI: Disable/Enable HA and DRS

Before upgrading my Virtual Center 2.5 server to vCenter Server 4.0, I decided to temporarily disable HA and DRS. This is just a precaution taken to avoid waiting for cluster reconfigurations right after the upgrade. Because I hate doing things more than once by hand, I used PowerCLI for this.

Although no rocket science you can use the following PowerCLI oneliner to disable HA and DRS on all clusters:

Get-Cluster | Set-Cluster -HAEnabled:$false -DrsEnabled:$false -Confirm:$false


Disabling DRS will delete any resource pool on the cluster without warning!!!
(Thanks to Daniel M (@dmVI) for pointing this out in the comments)

To enable HA and DRS again use:

Get-Cluster | Set-Cluster -HAEnabled:$true -DrsEnabled:$true -Confirm:$false

Related posts:

  1. List HBA WWPNs and LUNs using Powershell Tweet Lately I’m moving around my VMs and storage luns between my ESX clusters a lot to accomplish a complete redesign of my Virtual Infrastructure. At some point I got...
  2. PowerCLI: Match VM and Windows harddisks – Part 2 Tweet This is a follow up on a post I did a couple of weeks ago to create a mapping table between Windows- and VMware hard disks. In another previous...
  3. Match VM and Windows harddisks using PowerCLI Tweet Today I was asked to extend a disk of a Windows virtual machine. Normally this is a standard procedure and finished within minutes. The hardest part of the procedure...
  4. PowerCLI 4.0 U1 doesn’t reconnect to VIServer Tweet When I was testing with the new PowerCLI feature to work with multiple VIServers, I ran into a bug. Whenever you disconnect from a VIServer you can’t reconnect to...
  5. Setting custom attributes with VMware PowerCLI Tweet Last week I wanted to extend my vCenter with some extra custom attributes on my VMs. This would extend the usability of the Export List feature for reporting purposes....

2 Comments on “PowerCLI: Disable/Enable HA and DRS”

  1. #1 Daniel M (@dmVI)
    on Jun 5th, 2010 at 2:08 am

    It may pay to warn Admins that disabling DRS per Cluster deletes any Resource Groups created which could be an issue. When you use the vSphere Client to disable DRS it gives you a warning to that effect. The above script however wouldn’t provide that prompt as per the command.

  2. #2 Arnim van Lieshout
    on Jun 5th, 2010 at 9:37 am

    Thank you Daniel for pointing this out.

Leave a Comment