SCCM - Compliance Settings - Business Hours
Setting Business Hours
SCCM Compliance Settings is the ability to check returned variables and rectify them.
In this compliance Setting we have set up 2 things
- Configuration Item & Configuration Baseline.
In this compliance Setting we have set up 2 things
- Configuration Item & Configuration Baseline.
$cmClientUserSettings = [WmiClass]"\\.\ROOT\ccm\ClientSDK:CCM_ClientUXSettings"
$businessHours = $cmClientUserSettings.GetBusinessHours()
$businessHoursCI = [string]$businessHours.StartTime + "," + [string]$businessHours.EndTime + "," + [string]$businessHours.WorkingDays
Return $businessHoursCI
$startTime = 8
$endTime = 17
$workingDays = 62
$cmClientUserSettings = [WmiClass]"\\.\ROOT\ccm\ClientSDK:CCM_ClientUXSettings"
$businessHours = $cmClientUserSettings.PSBase.GetMethodParameters("SetBusinessHours")
$businessHours.StartTime = $StartTime
$businessHours.EndTime = $EndTime
$businessHours.WorkingDays = $WorkingDays
Try {
$result = $cmClientUserSettings.PSBase.InvokeMethod("SetBusinessHours", $businessHours, $Null)
If ($result.ReturnValue -eq 0 ) {
"Success."
}
Else {
"Failed to set SCCM client business hours."
}
}
Catch {
"Failed to set SCCM client business hours."
}
To calcualte the Attribute working Days you just add the following numbers together.
| Sunday | 1 |
| Monday | 2 |
| Tuesday | 4 |
| Wednesday | 8 |
| Thursday | 16 |
| Friday | 32 |
| Saturday | 64 |
Now we add in the Compliance Rule, this is the part that the discovery script is Return $businessHoursCI
in our case we want all our machines to Return $businessHoursCI a value of 8,19,62
to which means
the start time of business hours is 8AM
end of business hours is 17 (17 being 24 hour format for 5PM)
and as above the calucation total for
MON + TUES + WED + THURS + FRI = 62
2 + 4 + 8 +16 + 32 = 62
Configure Baseline for Deployment.
Tagged under
Latest from Dane Read
Login to post comments