{"id":3123,"date":"2018-03-23T04:39:12","date_gmt":"2018-03-23T04:39:12","guid":{"rendered":"http:\/\/pariswells.com\/blog\/?p=3123"},"modified":"2018-03-23T04:39:12","modified_gmt":"2018-03-23T04:39:12","slug":"how-to-deploy-scheduled-tasks-remotely-schtasks-and-batchpatch","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/random\/how-to-deploy-scheduled-tasks-remotely-schtasks-and-batchpatch","title":{"rendered":"How to Deploy Scheduled Tasks Remotely SCHTASKS and BatchPatch"},"content":{"rendered":"<p>Recently a Webroot Bug :\u00a0<a href=\"https:\/\/community.spiceworks.com\/topic\/2114911-netlogon-5820-endpoint-duplicate-windows-10\">https:\/\/community.spiceworks.com\/topic\/2114911-netlogon-5820-endpoint-duplicate-windows-10<\/a>\u00a0 and <a href=\"https:\/\/community.webroot.com\/t5\/Known-Issues-KB\/Netlogon-is-not-starting-after-Reboot\/ta-p\/316119\">https:\/\/community.webroot.com\/t5\/Known-Issues-KB\/Netlogon-is-not-starting-after-Reboot\/ta-p\/316119<\/a>\u00a0Had caused Netlogon service to not start on some machines which stops group\u00a0policy running. We needed to deploy the following which ran a script when it detected netlogon stopped :\u00a0<\/p><p><strong>SCHTASKS \/Create\u00a0 \/TN &#8220;System_NETLOGON_5820&#8221; \/TR c:\\Scripts\\netstartnetlogon.cmd \/SC ONEVENT \/RL Highest \/RU SYSTEM \/EC SYSTEM \/MO &#8220;*[System[Provider[@Name=&#8217;NETLOGON&#8217;] and EventID=5820]]&#8221; \/F<\/strong><\/p><p>With\u00a0netstartnetlogon.cmd stored on the local machine in C:\\Scripts\\containing &#8220;net start netlogon&#8221;<\/p><p>You can deploy a schedule task remotelty using :\u00a0<\/p><p>SCHTASKS \/Create \/s <strong>%machinename%<\/strong>\u00a0 \/TN &#8220;System_NETLOGON_5820&#8221; \/TR c:\\Scripts\\netstartnetlogon.cmd \/SC ONEVENT \/RL Highest \/RU SYSTEM \/EC SYSTEM \/MO &#8220;*[System[Provider[@Name=&#8217;NETLOGON&#8217;] and EventID=5820]]&#8221; \/F<\/p><p>Then Run it remotely using\u00a0<\/p><p>SCHTASKS \/run \/s <strong>%machinename%<\/strong>\u00a0 \/TN &#8220;System_NETLOGON_5820&#8221;<\/p><p>However it seemed a long method to go through all the machines with this. I used BatchPatch to deploy the\u00a0netstartnetlogon.cmd files into the Folder on each machine , then used the Deploy Software\/Patch\/Script\/Regkey to deploy and run the file :\u00a0<\/p><p>createscheduledtask.bat<\/p><p>Which containned :\u00a0<\/p><p>SCHTASKS \/Create \/TN &#8220;System_NETLOGON_5820&#8221; \/TR c:\\Scripts\\netstartnetlogon.cmd \/SC ONEVENT \/RL Highest \/RU SYSTEM \/EC SYSTEM \/MO &#8220;*[System[Provider[@Name=&#8217;NETLOGON&#8217;] and EventID=5820]]&#8221; \/F<br \/>SCHTASKS \/Run \/TN &#8220;System_NETLOGON_5820&#8221;<\/p>","protected":false},"excerpt":{"rendered":"<p>Recently a Webroot Bug :\u00a0https:\/\/community.spiceworks.com\/topic\/2114911-netlogon-5820-endpoint-duplicate-windows-10\u00a0 and https:\/\/community.webroot.com\/t5\/Known-Issues-KB\/Netlogon-is-not-starting-after-Reboot\/ta-p\/316119\u00a0Had caused Netlogon service to not start on some machines which stops group\u00a0policy running. We needed to deploy the following which [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[2327,2331,547,2332,2333,2335,2330,902,2329,2334],"class_list":["post-3123","post","type-post","status-publish","format-standard","hentry","category-random","tag-batchpatch","tag-deploy","tag-group-policy","tag-netlogon","tag-netlogon-service-to-not-start","tag-not-start","tag-remotely","tag-scheduled-task","tag-schtasks","tag-webroot"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/3123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=3123"}],"version-history":[{"count":1,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/3123\/revisions"}],"predecessor-version":[{"id":3124,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/3123\/revisions\/3124"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=3123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=3123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=3123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}