I am trying to get a compliance report check with
Get-spbmEntityConfiguration -VM $vm
but the ComplianceStatus column is showing blank even though in vcenter it shows as compliant
any idea?
I see the same in 12.3.
Might be a "feature", perhaps best to open an SR.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I see the same in 12.3.
Might be a "feature", perhaps best to open an SR.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks Luc
Luc,
I tried it on powercli v11 and works.
question is how do I get the Storage policy/status for both The VM and hard disks
There are 2 parametersets for the Get-spbmEntityConfiguration cmdlet, the 2nd one has a Harddisk parameter.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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
Did you try like this?
Get-Datacenter -PipelineVariable dc |
Get-Cluster -PipelineVariable cluster |
Get-VM -PipelineVariable vm |
Get-HardDisk -PipelineVariable hd |
ForEach-Object -Process {
New-Object -TypeName PSObject -Property ([ordered]@{
Datacenter = $dc.Name
Cluster = $cluster.Name
VM = $vm.Name
VMSpbmStatus = (Get-SpbmEntityConfiguration -VM $vm).ComplianceStatus
HD = $hd.Name
HDSpbmStatus = (Get-SpbmEntityConfiguration -HardDisk $hd).ComplianceStatus
})
} | Format-Table -AutoSize
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference