Highlighted
Contributor
Contributor

Get VM Automation Level via PowerCli

Setup:

  • 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?

4 Replies
Highlighted
Contributor
Contributor

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

Truth is a three edged sword
0 Kudos
Highlighted
User Moderator
User Moderator

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'}}}

}

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos
Highlighted
Contributor
Contributor

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

Regards

0 Kudos
Highlighted
Contributor
Contributor

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

0 Kudos