Kaseya Community

Need Help with script - Reboot with prompt

  • Hello. I am looking for some help with a reboot script. Here is what I want to do:

    - If user is not logged in, reboot immediately.
    - If user is logged in, Display YesNo dialog box asking for permission to reboot.
    --- If response=Yes, reboot immediately.
    --- If response=No, reschedule the prompt script for 15 minutes later.
    --- If timeout/no response within 15 minutes, reboot.

    I have everything workign except for the "timeout/no response" - as hitting the timeout limit executes ELSE - which in my case, is to not reboot and to simply reschedule the YesNo prompt.

    I am basically looking for the same behavior as Kaseya Patch Management Reboot - which is "If user logged in ask permission. Reboot if no response in X minutes. Reboot if user not logged in." But when I look through my script history, the Patch Reboot, Ask Reboot Continue1 and Ask Reboot Continue2 scripts that have executed in the past are missing some viewable content.

    Below are copies of my current work-in-progress scripts. Any help/suggestions would be greatly appreciate. Thanks very much.

    Lloyd

    ===================================
    Script Name: Reboot with YesNo Prompt 1 (Master)
    Script Description: Master script for reboot with YesNo prompt. Displays prompt if user is logged-in, remotts immediatly of user is not logged in.

    IF User Is Logged In
    Parameter 1 :
    THEN
    Execute Script
    Parameter 1 : Reboot with YesNo Prompt 2 (NOTE: Script reference is NOT imported. Correct manually in script editor.
    Parameter 2 :
    Parameter 3 : 0
    OS Type : 0
    ELSE
    Execute Script
    Parameter 1 : Reboot (NOTE: Script reference is NOT imported. Correct manually in script editor.
    Parameter 2 :
    Parameter 3 : 0
    OS Type : 0
    ===================================

    Script Name: Reboot with YesNo Prompt 2
    Script Description: Display prompt asking for permission to reboot. Yes=Reboot. No=prompt again in 10 minutes.

    IF User Response is Yes
    Parameter 1 : WolfTrack Agent needs to reboot your computer. Is it okay to reboot now? Yes=Reboot now. No=Ask again in 10 minutes.
    Parameter 2 : 5
    THEN
    Write Script Log Entry
    Parameter 1 : User chose Yes at Reboot prompt.
    OS Type : 0
    Reboot
    OS Type : 0
    ELSE
    Write Script Log Entry
    Parameter 1 : User chose No at Reboot prompt. Reschedule to 10 minutes later.
    OS Type : 0
    Schedule Script
    Parameter 1 : 27006337
    Parameter 2 : 10
    Parameter 3 :
    OS Type : 0
    ===================================

    Script Name: Reboot
    Script Description: Reboots computer immediately.

    IF True
    THEN
    Execute Shell Command
    Parameter 1 : eventcreate /L APPLICATION /T INFORMATION /SO WolfTrack /ID 999 /D "Reboot initiated via script."
    Parameter 2 : 1
    OS Type : 0
    Write Script Log Entry
    Parameter 1 : Reboot initiated via script.
    OS Type : 0
    Reboot
    OS Type : 0
    ELSE

    =================================================

    Legacy Forum Name: Need Help with script - Reboot with prompt,
    Legacy Posted By Username: lwolf
  • Hi Iwolf...

    Please search on forum: "reboot with user prompt" you will find another entry in witch I published the reboot script I successfully use...

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: christian@syneteksolutions.com
  • Christian,

    Thanks very much.

    Lloyd

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: lwolf