Retrieving baseline compliance data

After scanning your inventory objects against one or more baselines for missing patches or upgrades, you can use the Get-Compliance cmdlet to retrieve the compliance data. The syntax of the Get-Compliance cmdlet is as follows:

Get-Compliance [-Server <VIServer[]>] [-Entity] <InventoryItem> [-ComplianceStatus <ComplianceStatus>] [-Baseline <Baseline[]>] [-Detailed] [<CommonParameters>]

The -Entity parameter is required.

In the following example, we will retrieve the compliance status for the hosts in the cluster Cluster01 against the Critical Host Patches (Predefined) baseline:

PowerCLI C:> $Baseline = Get-Baseline -Name 'Critical Host
    Patches (Predefined)'
PowerCLI C:> Get-Compliance -Entity (Get-Cluster -Name
    'Cluster01') -Baseline $Baseline

The output of the preceding commands is as follows:

Entity        Baseline                           Status
------        --------                           ------
192.168.0.133 Critical Host Patches (Predefined) Unknown
192.168.0.134 Critical Host Patches (Predefined) NotCompliant
192.168.0.135 Critical Host Patches (Predefined) Compliant

In the preceding output, the status of host 192.168.0.133 is Unknown because the host is powered off. vSphere Update Manager cannot determine the status of hosts that are powered off. Host 192.168.0.134 has the status NotCompliant and is missing some critical host patches. Host 192.168.0.135 has status Compliant and has all the critical host patches installed.

In the second example of the Get-Compliance cmdlet, we will retrieve the compliance of the virtual machines in the New York data center against the VM Hardware Upgrade to Match Host (Predefined) baseline.

    PowerCLI C:> $Baseline = Get-Baseline -Name 'VM Hardware 
    Upgrade to Match Host (Predefined)'

PowerCLI C:> Get-Compliance -Entity (Get-datacenter -Name
    'New York') -Baseline $Baseline

The preceding command returns the following output:

Entity  Baseline                                       Status
------  --------                                       ------
VM2     VM Hardware Upgrade to Match Host (Predefined) Compliant
VM7     VM Hardware Upgrade to Match Host (Predefined) Compliant
VM4     VM Hardware Upgrade to Match Host (Predefined) Compliant
VM1     VM Hardware Upgrade to Match Host (Predefined) Compliant
VM10    VM Hardware Upgrade to Match Host (Predefined) Compliant
VM3     VM Hardware Upgrade to Match Host (Predefined) Compliant
vcenter VM Hardware Upgrade to Match Host (Predefined) Incompatible

As you can see in the preceding output, only the vcenter virtual machine is not compliant. It has status Incompatible. This is because the vCenter Server is a vCenter Server Virtual Appliance (vCSA).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.190.217.134