Automation

 View Only
  • 1.  Get-spbmEntityConfiguration shows complianceStatus is blank

    Posted Apr 23, 2021 01:26 PM

    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?

     

    tdubb123_0-1619184330303.png

     



  • 2.  RE: Get-spbmEntityConfiguration shows complianceStatus is blank
    Best Answer

    Posted Apr 23, 2021 02:14 PM

    I see the same in 12.3.
    Might be a "feature", perhaps best to open an SR.



  • 3.  RE: Get-spbmEntityConfiguration shows complianceStatus is blank

    Posted Apr 23, 2021 05:19 PM

    thanks Luc



  • 4.  RE: Get-spbmEntityConfiguration shows complianceStatus is blank

    Posted Apr 26, 2021 02:45 PM

    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

     

     



  • 5.  RE: Get-spbmEntityConfiguration shows complianceStatus is blank

    Posted Apr 26, 2021 03:19 PM

    There are 2 parametersets for the Get-spbmEntityConfiguration cmdlet, the 2nd one has a Harddisk parameter.



  • 6.  RE: Get-spbmEntityConfiguration shows complianceStatus is blank

    Posted Apr 26, 2021 04:49 PM

    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



  • 7.  RE: Get-spbmEntityConfiguration shows complianceStatus is blank

    Posted Apr 26, 2021 04:59 PM

    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