trying to get this to work. But only able to get the VM
foreach ($dc in $dcs) {
$clusters = $dc | get-cluster
foreach ($cluster in $clusters) {
foreach ($vm in $vms) {
$VMpol = Get-SpbmEntityConfiguration $vm
# foreach ($hd in (Get-HardDisk -VM $vm) {
$VMHDPol = Get-SpbmEntityConfiguration -HardDisk $hd
$row = "" | select VC, datacenter, cluster, VMHost, VM, HD, StoragePolicy, TimeofCheck, ComplianceStatus
$row.vc = $vc
$row.datacenter = $dc.name
$row.cluster = $cluster.Name
$row.VM = $vmpol.Name
$row.Storagepolicy = $vmpol.Storagepolicy.Name
$row.TimeofCheck = $vmpol.TimeofCheck
$row.ComplianceStatus = $vmpol.ComplianceStatus
$report += $row
}
}
}
}
$report | ft -AutoSize