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

  • So what is your "Daily Maintenance application"?

  • "Daily Maintenance" is a set of tools that we provide to perform endpoint maintenance on a regular basis. There are several parts, but the key components are:

    • A "scheduler" that reads the configuration file and runs the maintenance tasks. These are scheduled for day (low impact) and night (higher impact) for recurring intervals like "Daily", "Every Tuesday", or "Third Friday". The day tasks are run randomly based on when VSA deploys the tool and config files (6-8 AM for servers, 10 AM - 4 PM for workstations) while the Night tasks are started at a specific time.
    • Maintenance Tools - We provide several maintenance tools, but the MSP is free to schedule any task (EXE, bat, script, etc.) that they need to tailor the process. The configuration files are maintained on VSA and can be deployed globally, per customer, machine group, or specific agent. The scheduling engine has several tools built-in, such as the Uptime check (notifying the user or triggering an alert, as mentioned above), sending a user message (we use this to remind the user of Patch Night!), and schedule task to run at a specific time or condition. There are also controls that restrict a task to systems that have a detected product, such as SQL (any version) or Exchange-2013 (specific version); or the presence/absence of files, reg keys or values.
    • A User GUI - this is a SysTray resident interface that can display maintenance status, the last 50 tasks (what have we done for you lately), and provide links to the MSP web site and portal, and contact info. The next release, currently in development, will provide the ability to create a service request (PSA ticket) or trigger specific Agent Procedures to provide a fundamental Self Service feature.

    We've used this in our MSP practice for over 3 years and have seen a significant reduction in "nuisance" calls from end-users once regular maintenance was implemented. These are part of our Enhanced Maintenance and Monitoring components, which are licensed through our RMM Suite for VSA - a fully integrated add-on to VSA that automates VSA administration, provides enhanced monitoring (Smart Monitors), and extensive alert/event processing that automates remediation of events, filters unwanted events ("UPS started a Self Test" and similar junk), and interfaces to PSA platforms and notification services. You can get details in the Automation Exchange or on our web site.

    Glenn