Jump to content

Windows Reboot Manager


Recommended Posts

Hello all. I'm looking to implement a program that'll prompt users to reboot their computers when its needed. I have found a couple of similar programs here in the forums but not exactly what I need and I'm hoping that maybe I just didn't search correctly because it seems this would be a useful script to have for us in the sysadmin world. Basically, our users never reboot their computers so what we've done until now is force all machines to reboot on Sunday morning at 2am via Microsoft SCCM. If the user hasn't saved something, they are screwed. This has worked for the most part but we do get the occasional negative feedback so I'm wanting to implement something a little more elegant and something that would put the reboot more into the users hands up to a certain point. I've got a couple of registry keys that can be checked to see if a reboot is required (below). If a reboot is required, I want to show the user a message that a reboot is needed (I was thinking about using Melba23's "toast" program) and then start a timer and every hour, prompt them again and nag them until they do. After 24 hours, if they havent rebooted, it would be a little more forceful. Maybe pop up a GUI window that is more in their face and they can't work without responding to it. In the GUI, it would give them a button to reboot now or they can postpone it for 30 minutes. After they've postponed it x number of times, that postpone option goes away and they are then forced to reboot right then. I don't expect anyone to write the script for me but maybe it someone has something they've started or they've used in the past that is somewhat similar to what I'm looking for, I'd be interested in seeing how it was done.

These are the two registry items that I would check to determine if a reboot is required. If you are aware of any others, please let me know!

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

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations

Thanks!

Link to comment
Share on other sites

  • Moderators

Hi, Jimbone18. Those two keys are great places to look, and you seem to have a clear definition of what you would like to accomplish. I would suggest doing a forum search for Koda, to help you design the GUI as to how you want it to look, and taking a look at the help file under shutdown(). Try a couple things out and feel free to come back if you run into problems :oops:

Edit:

Below is a very (very) simple example of doing something like you explain. It may be a place for you to start. Good luck!

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
 
$r = "10"
_main()
 
Func _main()
$MyGUI = GUICreate("Reboot Needed", 493, 120, 192, 114)
$Message = GUICtrlCreateLabel("Windows needs to reboot your system to complete system changes. Please save your work and click" & @CRLF & "Reboot. Or click Delay to Postpone the operation for 30 minutes. You may postpone " & $r & " more times.", 0, 8, 601, 75)
$Button1 = GUICtrlCreateButton("Reboot", 50, 70, 153, 41)
$Button2 = GUICtrlCreateButton("Delay", 300, 70, 137, 41)
GUISetState(@SW_SHOW)
While 1
 $nMsg = GUIGetMsg()
 Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $Button1
   Shutdown(6)
  Case $Button2
   GUIDelete()
   _delay()
 EndSwitch
WEnd
EndFunc
 
Func _delay()
 $r -= 1
 Sleep(10000)
 _main()
EndFunc
Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...