VMware Cloud Community
rbhatt
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
mythrandir52
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
Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership

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
Reply
0 Kudos
Virtual_Boy
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

Reply
0 Kudos
JonathonTaylor0
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

Reply
0 Kudos