Kaseya Community

Automating/Scripting Reboots

  • I'm very new to Kaseya and am having a hard time writing scirpts.  I've never scripted or programmed before.

    So we want to script end user reboots in a way that checks last reboot and if not rebooted in X amount of days, reboots now.

    Is this possible?

  • This is easily possible but will result in a user riot if not done carefully! :)

    Our Daily Maintenance application handles end user reboots by checking the system uptime each day and comparing it against two threshold values - warning and Force. These are adjustable, but uses defaults of 10 and 25 days. The Maintenance tool also reboots the workstation every Sunday evening unless disabled by request or the agent is in sleep/hibernate mode at that time.

    When the first threshold is reached, the tool displays a message window (with the MSP's logo) telling the user about the excessive uptime and suggesting that they reboot at their earliest convenience. This is repeated every other day. When the uptime is within two days of the Force threshold, they are also told that the reboot will be required in # days.

    When the second threshold is reached, the user again sees a pop-up window with the MSP logo, but this time the message is System Modal, which means it can't be put behind any other application window and ignored. They MUST respond to it at that time. It asks them to select a convenient time TODAY to reboot their workstation and prompts them to select a time (15-minute intervals) between now and 11:45 PM. This schedules the reboot AND creates a background task with an internally generated target time of 4 AM the next day. If the computer is put to sleep or hibernated and the reboot task is not run, the second task will force the reboot immediately when the system wakes up. This insures that no workstation is up for more than the upper threshold that we set. We do have a small handful (< 5) of executives that don't run the uptime check in their daily maintenance, but they also have "White Glove" service for patching and app-updates once a month that they schedule with us. The Maintenance tasks can be defined globally, per customer, per customer location, or per agent.

    This has worked well for us to keep workstation uptime within reason while eliminating complaints about unexpected reboots. The same tool used for the Force threshold is used after patching to force a next-day reboot instead of nagging users for days to restart.

    Monthly server reboots are done with our patching process and not through Maintenance, and these are strictly scheduled. The above process is restricted to workstations.

    Glenn