VMware Cloud Community
Mallik7
Enthusiast
Enthusiast

Affinity / anti affinity rules check on vCenter 6.5 and ESXi host 6.5

I'm in need a of powercli script that helps to determine whether affinity rules are configured on any cluster or host.

TIA

0 Kudos
3 Replies
LucD
Leadership
Leadership

0 Kudos
Mallik7
Enthusiast
Enthusiast

I've this script which worked on 6.0, but, it is not working on 6.5 version (not giving any output when I ran this) -

$report = foreach($vc in $global:DefaultVIServers){

    foreach ($cluster in Get-Cluster -Server $vc){

        Get-DrsRule -Cluster $cluster|

        Select Name, Type, Enabled,

            @{N='vCenter';E={$vc.Name}},

            @{N='Cluster';E={$cluster.Name}}

    }

}

$report |Export-Csv -Path ".\DRSRuleReport-$(Get-Date -Format 'MMdd-HHmm').csv" -NoTypeInformation -UseCulture

0 Kudos
LucD
Leadership
Leadership

Works perfectly for me.

Perhaps there are no rules?

Are you looking at the correct CSV file?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos