You can download patches from a previously defined location.

Verify that you are connected to a vCenter Server system.

1

Retrieve all entities from the Datacenter data center and store the result in a variable.

$entities = Get-Inventory -Location Datacenter
2

Download all available patches and store the result in a variable.

$result = Sync-Patch
3

Check whether new patches are downloaded and start scanning the entities in the Datacenter data center.

if ($result.Count > 0) {
Test-Compliance -Entity $entities
}