Kaseya Community

Reboot Pending

This question has suggested answer(s)

Hello all!

Does anyone know how to determine which machines are pending a reboot (other than the view)?  I'm trying to determine if a reboot is pending via procedure although it doesn't appear that the related IF step exists.  In addition, this information doesn't exists in the views provided either (determined via documentation, not exploring).  I don't even mind having to run a script or custom program on the machine itself, just need to know where and what to look for.


All Replies
  • Go to Patch Management>Manage Machines>Patch Status

    If a machine is needing a reboot before going further with updates etc, it will tell you here. There is a button that says "Reboot now" which makes this page especially useful when doing patch review of several groups at once.

  • Johnathon: Yes, I am aware of this.  There is also a view that will display all machines pending reboot.  I'm trying to determine if a reboot is pending via procedure.

    [more detail]

    Let's say I install patches between the hours of 9am and 6pm and set the reboot policy to reboot at 10pm.  I'm worried that if the client shuts down their workstation at 8pm when they start it back up again they will be prompted to reboot - as the reboot at 10pm script still didn't execute.  My thought is to not reboot after patching and run a different script that can check if a reboot is required.  If so reboot.

    [/more detail]

  • This is an odd scenario, in my experience. If users are typically shutting down machines at night, then the patching script will never call the reboot procedure. Also, if they are shutting down, and patches did install during the day, they are essentially doing a reboot outside of the scripted reboot policy.

    It is best to set patch scans, reboot policy to skip if offline in a scenario like yours, because that means the users are rebooting it themselves more or less.

    Finally, I don't know why you would want to make a script and report just to see if a machine "needs" a reboot when there is already a panel to view this status in realtime should you be concerned reboots are needed beyond the user shutting down and booting every day.

    Just my thoughts. I don't know of any way to achieve what you are asking because it seems redundant and vague. (what criteria does "need a reboot" fulfill?)

    best regards, happy scripting

  • Jonathon: Yes, I agree.  If they shut down they are performing the task of "reboot".  Although in our experience the patching scripts still ask for the machine to be rebooted as the script still runs.  Now, with that said, I realize I haven't tested this with K2 so maybe they changed it.

    As far as why I want a report that shows if a machine needs a reboot, I don't.  I want a way to do so via scripting.

    "need a reboot":

    Under "Patch Management > Configure > Reboot Action" I would basically like to schedule a script to run the machine instead of rebooting or asking permission.  While asking permission makes the most sense, our clients complain about it all the time.  If I could run a script all it would do is write to a control file on the machine so yet another script could run later that night and determine if a reboot is still need (compare the time the file was written against the last time the machine was booted).  Since this isn't possible I'm thinking the next best thing is to determine BY SCRIPT if a reboot is needed.  THen under reboot action I can choose "Do not reboot after update" and allow the script to determine if a reboot is needed.

    Since realizing above that I haven't tested this functionality under K2 I could be wasting everyone's time.  I plan on testing soon and posting results here.

  • Josh: I know exactly what you mean.  For the end users that don't shut down their machines at end of day, I'm also looking into scheduling a script that will reboot only these machines at night after patching.

    Let me know what find.  It would be nice if one of the If checks the scripting can do was to check if a machine is pending a reboot, but looks like checking a file / registry for last shutdown / boot time would be next best thing.


  • We configure the reboot action under patch management on workstations to "Reboot every day at 03:00 after install" and servers "Reboot Monday at 03:00 after install" and they only restart if its installed a patch that requires a reboot.

  • We have a script that is scheduled to run that checks:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations

    if exists, then (step 2) if user is logged in, send message to reboot machine

    You'd think though that there would be a built in variable inside kaseya for the reboot status, the closest thing I've found is #vPatchStatus.PatchStatus# but couldn't get it to work.

    the "PendingFileRenameOperations" is not full proof, but takes a load off many pending end user reboots

  • @myArch-man:   Thank you!   That reg value is perfect..

    I am running a script to check for this value on all my servers..   If it finds the value it updates a custom system info field called "Reboot Status" with a 1 and if not a 0 (i keep it binary)..   At 4 am I then run another script that checks for the 1 or 0 and schedules the reboot if it is a 1 ( and of course resetting the 1 to a 0 )...  

    You have saved me a lot of work - thank you!

  • Thanks myArch-man - I just found this a few days ago although haven't had a chance to post.  While I was poking around I also found where Kaseya keeps the "Reboot Needed" flag in the database, although it's not available by view.

    If you take a look at the patchStatus table, there's a field named schedTogether.  If this field is '4' then a reboot is needed.

    Taking what we both found, I'd like to determine if rebooting manually using your method clears the reboot bending bit in the database...

  • Try this key for patch specific reboot testing

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired

    We test for this immediately after patch installs and call our own reboot script which checks for lots more 'Am I allowed to Reboot?' scenarios. We have all our machines (servers and workstations) set for no reboot after patch install and just let our scripting handle it.


  • Can you post your script to check for the key?


  • Grant:

    I found this registry key awhile ago although came to the conclusion that it's unreliable.  For example, today I checked this key on five machines that were "Pending Reboot" in Kaseya and the key did not exist... :(

  • Have just checked one of our servers that has a pending reboot according to kaseya but have manually run WUA on that machine and it does not want a reboot.  The registry key is also not there as expected, maybe the kaseya flag is unreliable?

    Our script just checks for the existance of the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired key.  Single if statement.