Here is what I'd like to script, but haven't seen much similar yet in my googling:

-If no user is logged in - reboot

-If user is logged in - check to see if winword.exe or excel.exe are running

            -If either are running prompt user to save all documents and then reboot

                         -Dialog options: OK (Reboot now), Snooze (but re-prompt after 1 hour)

            -If neither process is running - reboot


I see that I can get Kace to check for running processes, and have done this for scripts successfully.  I don't see how I can get user prompts for input within a single Kace script (the OK or Snooze buttons), it seems like only static message boxes are an option.


So as a work around I was thinking seperate scripts:

-Script one: Checks for the running processes and if they are running leaves a flag file (C:\promptforreboot.txt or something)

-Script two: Anything with that flag file gets the "Alert User Before Run" dialog, with OK causing a reboot and Snooze snoozing for 1 hour

-Script three: Anything without the processes running, and without a flag file gets rebooted immediately


That's all pretty awkward to make work, and I feel like there is room for error.  Any tips?

0 Comments   [ + ] Show Comments


Please log in to comment

Community Chosen Answer


Have you looked at AutoIt? I use this to create exe's that perform certain tasks.

Compile the script below into an exe. Then upload the exe as a dependency.

Sample Reboot Script:

$answer = MsgBox(1, "Reboot", "Some Text.....Click OK to reboot now.")

If $answer = 1 Then



If $answer = 2 Then


Answered 05/06/2013 by: dugullett
Red Belt

  • That tool is pretty awesome, and I've never seen it before. Thanks!

    BUT, I've been trying to avoid making scripts and executables outside of Kace and just having Kace run them because then I lose the granular reporting that Kace offers when each step is outlined separately. If I just tell it to run a .exe it only tells me that it ran or not, and doesn't say if the .exe actually did what it was meant to do.

    I'm finding out that everyone just does that and calls it a day because Kace is finnicky and the documentation to say it politely...skeletal.
Please log in to comment



Here is what I decided to do:

  • Script  One: Checks for running processes of winword.exe and excel.exe.  If running: abort. If not running: reboot.  Applied to a label I have for all desktops (NOT all computers).
  1. Launch a Program:
  2. Directory: %WINDIR%\System32
  3. File: cmd.exe
  4. Wait for completion: Yes
  5. Paramters: /C shutdown -r -c "PC will reboot in 1 minute.  Please save all work." -t 90 -d P:1:1
  • Smart Label that identifies desktop computers with uptime > 7 Days, and applies "Reboot Required" label
  • Script Two: Applies only to "Reboot Required" label.  Runs an exe, code below.  Screenshots are attached.  I built the exe in AutoIT.  Thanks dugullett!

#Region - Check for open winword.exe

If ProcessExists("winword.exe") Then

$answer = MsgBox(0, "Weekly Maintenance", "Word is open.  Please save your documents and close Word.")

ToolTip("Waiting for Word to close.", 0, 513, "Please save your documents.", 5)





#Region - Check for open excel.exe

If ProcessExists("excel.exe") Then

$answer = MsgBox(0, "Weekly Maintenance", "Excel is open.  Please save your documents and close Excel.")

ToolTip("Waiting for Excel to close.", 0, 513, "Please save your documents.", 5)






#Region - Prompt for reboot

$answer = MsgBox(292, "Weekly Maintenance", "Are you ready to reboot now?" & @CRLF & "- Be sure all of your files are saved." & @CRLF & "- You will be asked hourly until you accept.")

If $answer = 6 Then

Shutdown (18)



If $answer = 7 Then




Answered 05/07/2013 by: mpeters
Senior White Belt

  • Nice. I know this type of question has been asked before. I know they have a great forum to answer any questions. It's a very useful tool.
Please log in to comment
Answer this question or Comment on this question for clarity