I have had a few clients that have had the request of having multiple business hours for differnt sites or departments for one reason for another. When you have alot of machines its not the best idea to just bounce to each machine and set the hours so I stumbled upon this and it has been a life saver.
Go to Asset Compliance > Configuration Items and right click to create a new configuraton item.
You create a discovery script to get your current settings:
$cmClientUserSettings = [WmiClass]"\\.\ROOT\ccm\ClientSDK:CCM_ClientUXSettings" $businessHours = $cmClientUserSettings.GetBusinessHours() $businessHoursCI = [string]$businessHours.StartTime + "," + [string]$businessHours.EndTime + "," + [string]$businessHours.WorkingDays Return $businessHoursCI
It will return a value like 7,19,62 for 7 am to 7pm Monday-Friday all you would do to modify that is use the script below and the chart to add up the days.
Sunday 1 Monday 2 Tuesday 4 Wednesday 8 Thursday 16 Friday 32 Saturday 64
So if you would want Sunday - Saturday it would be 127 then 5am to 7 pm you would just modify the script to look like it does below.
You create a remediation script to set new business hours:
$startTime = 5 $endTime = 19 $workingDays = 127 $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." }
You can then deploy that to every machine or if you would like to have multiple business hours you would make multiple configuration items then just deploy them to seperate collections. This has come in handy for me being able to set multiple business hours across a company, I hope somebody else finds it useful.
Bryan