You can check whether a virtual machine has any baselines with unknown compliance status attached to it and start a scan.

Prerequisites

Verify that you are connected to a vCenter Server system.

Procedure

  1. Retrieve the compliance statuses with the value Unknown for the baselines attached to the VM virtual machine and store them in the $statuses variable.
    $statuses = Get-Compliance -Entity VM -ComplianceStatus Unknown
  2. Check whether the virtual machine has any baselines with unknown compliance status attached to it and start a scan.
    if ($statuses.Count -gt 0) {
    Test-Compliance -Entity VM -RunAsync"
    }