Start-SCComplianceScan
Start-SCComplianceScan
Starts a compliance scan of a managed computer or host cluster.
Syntax
Parameter Set: VMHostCluster
Start-SCComplianceScan -VMHostCluster <HostCluster> [-Baseline <Baseline> ] [-JobVariable <String> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [-VMMServer <ServerConnection> ] [ <CommonParameters>]
Parameter Set: VMMManagedComputer
Start-SCComplianceScan -VMMManagedComputer <VMMManagedComputer> [-Baseline <Baseline> ] [-JobVariable <String> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [-VMMServer <ServerConnection> ] [ <CommonParameters>]
Detailed 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.
Parameters
-Baseline<Baseline>
Specifies a VMM baseline object.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
-JobVariable<String>
Specifies that job progress is tracked and stored in the variable named by this parameter.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-PROTipID<Guid]>
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.
Aliases |
none |
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.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-VMHostCluster<HostCluster>
Specifies a VMM host cluster object.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
-VMMManagedComputer<VMMManagedComputer>
Specifies a computer object that is managed by VMM.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
-VMMServer<ServerConnection>
Specifies a VMM server object.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
- ComplianceStatus
- VMHostCluster
Examples
Example 1: Scan a host against a given baseline
The first command gets the host object named VMHost01, and then stores the object in the $VMHost variable.
The second command gets the compliance status object for the host stored in $VMHost01, and then stores the object in the $Compliance variable.
The next three lines use a Foreach statement to loop 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. For information about the Windows PowerShell Foreach statement, type Get-Help about_Foreach
.
The last command starts the compliance scan on the host, using the baseline stored in $Baseline, which in this example is Security 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