Setup:
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?
Did you find any answers to this i am looking for how to find the automation level by powercli too?
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'}}}
}
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
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