VMware Cloud Community
markdjones82
Expert
Expert

Compliance Report Script

I am running powercli 5.1 with VUM 5.1 and the ExportCompliancereport that is provided in the documents section.  I am getting the error below on almost all of my VM's and I am unsure why?

Get-Compliance : 12/31/2013 11:28:28 AMGet-Compliance    Requested valu

e 'guestToolsSupportedOld' was not found.

At \ExportComplianceToCS

V.ps1:160 char:31

+ $compliances = Get-Compliance <<<<  -Entity $inventoryItem -Detailed
+ CategoryInfo      : NotSpecified: (:) [Get-Compliance], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VumAutomatio

   n.Commands.GetCompliance

http://www.twitter.com/markdjones82 | http://nutzandbolts.wordpress.com
Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership

That problem was mentioned before, see update manager problems (after upgrade from 4.1u2 to 5.0u1)

Does it work when you leave out the Detailed switch ?


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

markdjones82
Expert
Expert

Yeah I found that thread earlier, but I wasn't sure if it was going to be able to get all the properties for the script to work.  I will try it with removing the -detailed flag and see if the report works properly.

http://www.twitter.com/markdjones82 | http://nutzandbolts.wordpress.com
Reply
0 Kudos
markdjones82
Expert
Expert

Hmm ok so no errors when this is ran, but it puts all of them in the VA compliance csv because the type comes out as "VMware.VumAutomation.Types.BaselineCompliance" when not running the detailed. So it puts them in the default bucket VA appliance. Looks like without the "detailed" switch it doesn't get the fullname type to categorize it right.  Anyone have anymore thoughts?

foreach ($inventoryItem in $inventoryItems) {

    $compliances = Get-Compliance -Entity $inventoryItem

   

    if ($compliances -ne $null) {

        foreach ($compliance in $compliances) {

            $fullName = $compliance.GetType().FullName

            if ($fullName -eq "VMware.VumAutomation.Types.PatchBaselineCompliance") {

                $patchBaselineCompliances += $compliance

            } elseif ($fullName -eq "VMware.VumAutomation.Types.VMHWUpgradeBaselineCompliance") {

                $vmHWUpgradeBaselineCompliances += $compliance

            } elseif ($fullName -eq "VMware.VumAutomation.Types.VMToolsUpgradeBaselineCompliance") {

                $vmToolsUpgradeBaselineCompliances += $compliance               

            } elseif ($fullName -eq "VMware.VumAutomation.Types.BaselineCompliance") {

                if ($compliance.Baseline.GetType().FullName -eq "VMware.VumAutomation.Types.HostUpgradeBaselineImpl") {

                     $hostUpgradeBaselineCompliances += $compliance

                } else {

                    $vaUpgradeBaselineCompliances += $compliance

                }

            }

        }

    }

}

http://www.twitter.com/markdjones82 | http://nutzandbolts.wordpress.com
Reply
0 Kudos