Created
November 20, 2015 19:23
-
-
Save lamw/7135a7ef3e8efb7913d8 to your computer and use it in GitHub Desktop.
Listing all vSphere DRS Rules that have been defined for a VM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$clusterName = "VSAN-Cluster" | |
$cluster = Get-Cluster -Name $clusterName | |
$vms = Get-View ($cluster| Get-VM) | |
$cluster_view = Get-View ($cluster) | |
foreach ($vm in $vms) { | |
# Using new vSphere 6.0 API (http://www.virtuallyghetto.com/2015/02/handy-new-vsphere-6-0-apis-to-be-aware-of.html) | |
$cluster_view.FindRulesForVm($vm.MoRef) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment