Get-Compliance
This cmdlet retrieves baseline compliance data for the specified object of type Template, VirtualMachine, VMHost, Cluster, Datacenter, Folder, and VApp. The cmdlet returns information about the compliance of the specified entity with the baselines that are attached to it. If the entity is a container, the cmdlet returns compliance data for all objects in the container.
Syntax
[-Baseline <Baseline[]>]
[-ComplianceStatus <ComplianceStatus>]
[-Detailed]
[-Server <VIServer[]>]
[CommonParameters]
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required |
|
InventoryItem | named |
|
Specifies a Template, VirtualMachine, VMHost, Cluster, Datacenter, Folder, or VApp object for which you want to retrieve the compliance status. | optional |
|
Baseline[] | named |
|
Specifies the baseline for which you want to retrieve the compliance status. | optional |
|
ComplianceStatus | named |
|
Specifies the status of the compliance you want to retrieve. The valid values are Compliant, NotCompliant, Unknown, and Incompatible. | optional |
|
SwitchParameter | named |
|
Specifies that you want to retrieve detailed information about the compliance. For patch baselines, the patches with different statuses are listed. For VMTools upgrade baselines, the detailed information contains the VMware Tools status. For VM Hardware upgrade baseline, the recommended VM Hardware version and the current VM Hardware version are displayed. | optional |
|
VIServer[] | named |
|
Specifies the vSphere servers on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. |
Output
Examples
Example 1
Retrieves a list of all baselines attached to the VM virtual machine and shows their compliance status and the number of the Compliant, NotCompliant, Unknown and NotApplicable patches.
Example 2
Retrieves a list of all baselines attached to the datacenters in $datacenter and shows their compliance status and the number of the Compliant, NotCompliant and Unknown patches.
Example 3
Retrieves a list of all baselines attached to the VM virtual machine and shows their compliance status and the number of the Compliant, NotCompliant, Unknown and NotApplicable patches.
Example 4
Retrieves the compliance status for all virtual machines in the Datacenter datacenter whose names start with "VM".
Example 5
Retrieves the compliance status of the baselines attached to the VM virtual machine. If there is at least one baseline with Unknown compliance status, a scan is started.
Related Commands