Start-SCComplianceScan

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

Syntax

Start-SCComplianceScan
     [-VMMServer <ServerConnection>]
     -VMHostCluster <HostCluster>
     [-Baseline <Baseline>]
     [-RunAsynchronously]
     [-PROTipID <Guid>]
     [-JobVariable <String>]
     [<CommonParameters>]
Start-SCComplianceScan
     [-VMMServer <ServerConnection>]
     [-Baseline <Baseline>]
     -VMMManagedComputer <VMMManagedComputer>
     [-RunAsynchronously]
     [-PROTipID <Guid>]
     [-JobVariable <String>]
     [<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
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-JobVariable

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

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

-PROTipID

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

Type:Guid
Position:Named
Default value:None
Required:False
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
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VMHostCluster

Specifies a VMM host cluster object.

Type:HostCluster
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-VMMManagedComputer

Specifies a computer object that is managed by VMM.

Type:VMMManagedComputer
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-VMMServer

Specifies a VMM server object.

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

Outputs

ComplianceStatus