4 Replies Latest reply on Aug 12, 2019 2:13 PM by JonathonTaylor0

    Get VM Automation Level via PowerCli

    rbhatt Lurker


      • Fully automated DRS cluster
      • Virtual Machine options - "Enable individual virtual machine automation levels" checked.
      • Most of the VMs have default automation level set
      • Few VMs have Disabled automation level


      How can I get List of those Virtual Machines whose Automation Level is set to disabled using PowerCli? Is there any way?

      Or is there any way just to get list of all VMs and their automation level using powercli?

        • 1. Re: Get VM Automation Level via PowerCli
          mythrandir52 Novice

          Did you find any answers to this i am looking for how to find the automation level by powercli too?

          • 2. Re: Get VM Automation Level via PowerCli
            RvdNieuwendijk Virtuoso
            vExpertUser Moderators

            The following PowerCLI command will show you all of the virtual machines and their automation level, if the automation level is not set to the cluster default:


            Get-Cluster | ForEach-Object {

              $Cluster = $_

              $Cluster.Extensiondata.Configuration.DrsVmConfig |

              Select-Object -Property @{Name='Cluster';Expression={$Cluster}},

                @{Name='VM';Expression={Get-VM -Id $_.Key}},

                @{Name='Automation Level';Expression={if ($_.Enabled) {$_.Behavior} else {'Disabled'}}}


            • 3. Re: Get VM Automation Level via PowerCli
              Virtual_Boy Lurker

              Hi rbhatt,


              As far as I know  you can get Vm DRS automation level from get-vm (Alt least in 6.x)


              i would propose:


              get-cluster -name ClusterName|Get-VM|select Name, DrsAutomationLevel




              • 4. Re: Get VM Automation Level via PowerCli
                JonathonTaylor0 Lurker

                Simple script to list out automation level of all clusters..




                #Get All Clusters information

                $clusters = Get-Cluster



                #Prep Output

                $output = @()



                #loop through each cluster

                foreach($cluster in $clusters) {

                    #additional lookups

                        # none needed



                    #Build output record

                    $OutputByCluster = New-Object Object



                    $OutputByCluster | Add-Member noteproperty "Cluster" $Cluster.Name

                    $OutputByCluster | Add-Member noteproperty "DRS" $Cluster.DrsAutomationLevel



                    #add to output object

                    $output += $OutputByCluster




                #output to file

                $output | Export-Csv -NoTypeInformation -UseCulture z:\ClusterAutomationLevel.csv