## PowerCLI Reference

# Test-Compliance

## Synopsis

This cmdlet scans inventory objects for baselines attached to them.

Syntax

Test-Compliance [-Server <VIServer[]>] [-Entity] <InventoryItem[]> [[-UpdateType] <UpdateType[]>] [-RunAsync] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version
Get-Compliance
Update-Entity

Detailed Description

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.

Parameters

Name | Description | Required? | Pipeline Input | Default Value
--- | --- | --- | --- | ---
Server | 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. | false | false |
Entity | Specifies Template, VirtualMachine, VMHost, Cluster, Datacenter, Folder, and VApp objects you want to scan for baselines attached to them. | true | true (ByValue) |
UpdateType | Specifies the type of the patches and upgrades you want to scan. The valid values are HostPatch, HostUpgrade, HostThirdParty, VmHardwareUpgrade, VmPatch, VmToolsUpgrade, and VaUpgrade. The VmPatch value is deprecated and will be removed in a following release. | false | false |
RunAsync | 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. | false | false |
WhatIf | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. | false | false |
Confirm | Indicates that the cmdlet asks for confirmation before running. | false | false |

Return Type

VMware.VimAutomation.Types.Task[] or null If RunAsync is set, the return value is a Task object that represents the scanning task on the vSphere server. If RunAsync is not set, no value is returned.

Notes

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.

Copyright © 1998 - 2015 VMware, Inc. All rights reserved.