Test-Compliance Command | Vmware PowerCLI Reference

Test-Compliance

This cmdlet scans inventory objects for baselines attached to them. The following object types are supported - Template, VirtualMachine, VMHost, Cluster, Datacenter, and Folder. If the inventory objects are of different types, the cmdlet starts a separate task for each object.

Syntax

Test-Compliance
[ -Entity ] < InventoryItem[] >
[-ProgressAction < ActionPreference > ]
[-RunAsync ]
[-Server < VIServer[] > ]
[-UpdateType < UpdateType[] > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
Entity InventoryItem[] 1
  • pipeline
Specifies Template, VirtualMachine, VMHost, Cluster, Datacenter, Folder, and VApp objects you want to scan for baselines attached to them.
optional ProgressAction ActionPreference named
optional RunAsync SwitchParameter named
Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the -RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console.
optional Server 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.
optional UpdateType UpdateType[] named
Specifies the type of the patches and upgrades you want to scan. The valid values are HostPatch, HostUpgrade, HostDVSUpgrade, VmHardwareUpgrade, VmPatch, VmToolsUpgrade, and VaUpgrade. The VmPatch value is deprecated and will be removed in a following release.

Output

Examples

Example 1

Test-Compliance -Entity VM -RunAsync

Scans the VM virtual machine. Since the -RunAsync parameter is set, the cmdlet runs asynchronously and a Task object is returned.

Example 2

Get-Inventory -Name VM | Test-Compliance

Scans the VM virtual machine for baselines attached to it.

Example 3

Get-Inventory -Name MyHost | Test-Compliance -UpdateType HostPatch

Scans virtual machine host for patches running asynchronously.

Example 4

Get-Inventory -Name MyVM | Test-Compliance -UpdateType VmHardwareUpgrade, VmToolsUpgrade

Scan the MyVM virtual machine for upgrades.

Related Commands

Compliance

This cmdlet retrieves baseline compliance data for the specified object.

This cmdlet scans inventory objects for baselines attached to them.