{"id":28,"date":"2017-04-19T12:23:19","date_gmt":"2017-04-19T17:23:19","guid":{"rendered":"https:\/\/spsroot.com\/wp\/?p=28"},"modified":"2018-03-06T10:49:47","modified_gmt":"2018-03-06T16:49:47","slug":"configmgr-update-client-business-hours","status":"publish","type":"post","link":"https:\/\/spsroot.com\/wp\/2017\/04\/configmgr-update-client-business-hours\/","title":{"rendered":"ConfigMgr: Force update Client Business Hours using Compliance"},"content":{"rendered":"<p>I&#8217;ve started using a Compliance policy to force the client&#8217;s business hours. The only thing I look for is that the &#8216;StartTime&#8217; has been set back to 5am.<\/p>\n<p>Configuration Item<br \/>\n<strong>Discovery script<\/strong>:<!--more--><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># Boolean\r\nIf (Get-CimClass -Namespace \"root\\ccm\\ClientSDK\" -ClassName CCM_ClientUXSettings -ErrorAction SilentlyContinue) {\r\n\t$StartTime = (Invoke-CimMethod -Namespace \"root\\ccm\\ClientSDK\" -Class CCM_ClientUXSettings -MethodName GetBusinessHours).StartTime\r\n} Else {\r\n\t$StartTime = 8\r\n}\r\nIf ($StartTime -eq 5) { return $false } else { return $true }<\/pre>\n<p>I use a Boolean since all I care about is that the default &#8216;StartTime&#8217; isn&#8217;t set and I found out you can&#8217;t enable Remediation with a Compliance rule (integer) of &#8220;not equals.&#8221; I also double check that the class &#8220;CCM_ClientUXSettings&#8221; exists just in case so it doesn&#8217;t try remediation on a machine that would seem to be having other issues already.<\/p>\n<p><strong>Remediation script<\/strong>:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">[uint32]$startTime = 8\r\n[uint32]$endTime = 17\r\n[uint32]$workingDays = 62\r\n$return = Invoke-CimMethod -Namespace \"root\\ccm\\ClientSDK\" -Class CCM_ClientUXSettings -MethodName SetBusinessHours -Arguments @{StartTime=$StartTime;EndTime=$EndTime;WorkingDays=$WorkingDays}<\/pre>\n<p>The default settings I use is 8am to 5pm (Monday to Friday).<\/p>\n<p>I then set the rule for compliance to equal true and run the remediation\u00a0script if not.<\/p>\n<p><a href=\"https:\/\/spsroot.com\/wp\/wp-content\/uploads\/2017\/04\/ComplianceBusinessHoursRule.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-32\" src=\"https:\/\/spsroot.com\/wp\/wp-content\/uploads\/2017\/04\/ComplianceBusinessHoursRule-296x300.png\" alt=\"Compliance Rule\" width=\"296\" height=\"300\" srcset=\"https:\/\/spsroot.com\/wp\/wp-content\/uploads\/2017\/04\/ComplianceBusinessHoursRule-296x300.png 296w, https:\/\/spsroot.com\/wp\/wp-content\/uploads\/2017\/04\/ComplianceBusinessHoursRule.png 494w\" sizes=\"auto, (max-width: 296px) 100vw, 296px\" \/><\/a><\/p>\n<p>Then put the item in a Configuration Baseline and deploy.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve started using a Compliance policy to force the client&#8217;s business hours. The only thing I look for is that the &#8216;StartTime&#8217; has been set back to 5am. Configuration Item Discovery script:<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[10,9,29],"class_list":["post-28","post","type-post","status-publish","format-standard","hentry","category-configmgr","tag-compliance","tag-configmgr","tag-sccm"],"_links":{"self":[{"href":"https:\/\/spsroot.com\/wp\/wp-json\/wp\/v2\/posts\/28","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/spsroot.com\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/spsroot.com\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/spsroot.com\/wp\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/spsroot.com\/wp\/wp-json\/wp\/v2\/comments?post=28"}],"version-history":[{"count":6,"href":"https:\/\/spsroot.com\/wp\/wp-json\/wp\/v2\/posts\/28\/revisions"}],"predecessor-version":[{"id":68,"href":"https:\/\/spsroot.com\/wp\/wp-json\/wp\/v2\/posts\/28\/revisions\/68"}],"wp:attachment":[{"href":"https:\/\/spsroot.com\/wp\/wp-json\/wp\/v2\/media?parent=28"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/spsroot.com\/wp\/wp-json\/wp\/v2\/categories?post=28"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/spsroot.com\/wp\/wp-json\/wp\/v2\/tags?post=28"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}