1

Have a script that reboots a large number of computers every 2 hours when no user is logged on. The script sleeps a random time up to 1 hour 59 minutes after being started before testing if a user is logged on and if no users reboots the computer. We are deploying the script via an SCCM package with a repeat time of 2 hours and always rerun.

We don't want to interfere with SCCM installing software by rebooting mid SCCM install so it would be useful to know how to test if SCCM or any other service is currently installing software so that a reboot can be inhibited in that case.

1 Answer 1

1

Your reboot script should stop the CcmExec service and wait for it to enter the stopped state. It should only reboot once the service is stopped. AFAICT when the service receives a stop signal it will safely complete all of its tasks including any ongoing installations.

21
  • Thanks for taking the time to read this through. If it works, that is an excellent solution Will test your solution out during a system reload Might take a few days to confirm and if it does I'll accept your answer
    – sdjuan
    Feb 19, 2016 at 17:30
  • 1
    I understand your concerns. FWIW I have found scarce little documentation by Microsoft that accurately describes the detailed behavior of SCCM.
    – alx9r
    Feb 20, 2016 at 5:05
  • 1
    To add to your consideration: Here's some evidence of CcmExec self-inflicting harm related to rebooting. That problem remains as of SCCM 2012 r2 sp1 cu2. I just reproduced it this week.
    – alx9r
    Feb 20, 2016 at 5:17
  • 1
    ccmexec is definitely a service on all my clients. It is named "SMS Agent Host" in the Services MMC console. The Services console shows the WMI DisplayName not the WMI Name. The CcmExec service launches a process called CcmExec.exe. You need to stop the service, not kill the process.
    – alx9r
    Feb 23, 2016 at 21:40
  • 1
    I have done testing now and accepted your answer. As mentioned I was unable to stop ccmexec when a task sequence was running which is OK as the script then does not try to reboot while that task sequence is running which is the desired outcome. I then tested stopping ccmexec when individually deploying a bunch of applications and programs and the service stopped gracefully and after reboot delay started as normal and continued with any remaining installs. Thanks for your help.
    – sdjuan
    Feb 24, 2016 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.