Start-SCComplianceScan

Starts a compliance scan of a managed computer or host cluster.

Syntax

Start-SCComplianceScan [-Baseline <Baseline>] [-JobVariable <String>] [-PROTipID <Guid>] [-RunAsynchronously]
 -VMHostCluster <HostCluster> [-VMMServer <ServerConnection>] [<CommonParameters>]
Start-SCComplianceScan [-Baseline <Baseline>] [-JobVariable <String>] [-PROTipID <Guid>] [-RunAsynchronously]
 -VMMManagedComputer <VMMManagedComputer> [-VMMServer <ServerConnection>] [<CommonParameters>]

Description

The Start-SCComplianceScan cmdlet starts a compliance scan of a managed computer or host cluster. During a compliance scan, the specified managed computer or host cluster is compared against assigned baselines, and the resulting compliance state is returned.

Examples

Example 1: Scan a host against a given baseline

PS C:\> $VMHost = Get-SCVMHost -ComputerName "VMHost01"
PS C:\> $Compliance = Get-SCComplianceStatus -VMMManagedComputer $VMHost.ManagedComputer
PS C:\> foreach($Bsc in $Compliance.BaselineLevelComplianceStatus)`
PS C:\> {if ($Bsc.Baseline.Name -eq "Security Baseline")`
PS C:\> {$Baseline = $Bsc.Baseline; break}}
PS C:\> Start-SCComplianceScan -VMMManagedComputer $VMHost.ManagedComputer -Baseline $Baseline

The first command gets the host object named VMHost01 and stores the object in the $VMHost variable.

The second command gets the compliance status object for the host stored in $VMHost01 and stores the object in the $Compliance variable.

The next three lines use a ForEach statement to iterate through the baseline compliance status objects for the host. If the baseline named Security Baseline is found, then the fifth command stores it in the $Baseline variable.

The last command starts the compliance scan on the host, using the baseline stored in $Baseline, which in this example is Security Baseline.

Parameters

-Baseline

Specifies a VMM baseline object.

Type:Baseline
Required:False
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-JobVariable

Specifies that job progress is tracked and stored in the variable named by this parameter.

Type:String
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PROTipID

Specifies the ID of the Performance and Resource Optimization (PRO) tips.

Type:Guid
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

Type:SwitchParameter
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-VMHostCluster

Specifies a VMM host cluster object.

Type:HostCluster
Required:True
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-VMMManagedComputer

Specifies a computer object that is managed by VMM.

Type:VMMManagedComputer
Required:True
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-VMMServer

Specifies a VMM server object.

Type:ServerConnection
Required:False
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False

Outputs

ComplianceStatus