Windows 10 – Shutdown message with countdown and cancel

With such a heavy emphasis being placed on ‘green IT’ system administrators are now being asked to have all the company workstations shutdown at a set time.

This can be achieved through various methods including purchasing specalised products, but often there’s limited ability for end users to cancel or pause the shutdown. This adds a risk of a user still using the computer when the shutdown begins and loosing their work.

These HTA scripts are free and can be used to give a customised warning to users before their computers are automatically shutdown.

Shutdown HTA script – version 1

mb_shutdown

This version of Shutdown HTA features

  • A large cancel button and a 60 second countdown before the shutdown begins.
  • Improved countdown – now runs smoothly, says ‘minutes’ if there are 2 or more minutes remaining, says ‘minute’ if one minute remaining, and only says ‘seconds’ if in the last 60 second count down. A special thanks to Dave (see comments below) for helping improve the countdown.
  • When ran the window is placed on top of all open windows
  • When the 60 second count down sarts the window is placed on top of all open windows
  • plays a system beep when the HTA is ran
  • plays a system beep during the last 60 seconds of the count down

How to customise this script

  • change ‘var mins = 2.1;’ to the amount of minutes the countdown is required for
  • Change ‘<p><img src=”https://www.example.com/logo.png” /></p>’  to point to your company logo, or delete
  • to remove the system beep, delete beep(); from line 131
  • to have the system RESTART (rather than shutdown) change ‘objSystem.Win32Shutdown 5’ to ‘objSystem.Win32Shutdown 6’

How to implement this script

  1. Download using the link below.
  2. Customise the script as required.
  3. Schedule the script to run using the Windows Task Scheduler (or your other third party application).
  4. TIP: To implement this script you could have a copy on each workstation and have a local schedule call it, or you could create a server side script to psexec it on each workstation (calling the file from the server).

 

Need help adding the HTA application to a Windows 7 Scheduled Task? See: Windows 7 – Run Scheduled Task Interactively

 

Shutdown HTA script – version 2

Special thanks to Chris (see comments below) for this version of the shutdown HTA script.

ShutdownHTA2

This version does all above with the addition of being able to:

  • Delay for 24 hours
  • Delay for 15 minutes
  • Delay for 30 minutes
  • Delay for 60 minutes

As well as a different look and feel to the GUI.

Article Downloads

TIP: You may need to right-click and select 'save link as'.

Tagged in

71 comments on “Windows 10 – Shutdown message with countdown and cancel

  1. Hi Jason,

    Have you given this a try?

    One of our readers used this method at his workplace.
    He used group policy preferences to push out the configuration.

    [url=http://www.mockbox.net/windows-7-tips/473-windows-7-run-scheduled-task-interactively.html]Windows 7 – Run Scheduled task interactively[/url]

  2. [quote name=”Jason”]Hello everyone. I am having trouble scheduling this .hta to run in Windows 7. I can run it successfully by double clicking the hta iteslf, and I can run it from command line using mshta.exe “C:scriptsshutdownshutdown.hta”. Unfortunately, when I schedule the task to run using a domain account (my end users dont have permission to create scheduled tasks) the hta will not display. The mshta.exe process is running in Task Manager, and if I leave it alone, it WILL restart the computer in 10 minutes, but I never get the display or the warning beeps. Any ideas?

    Thanks for the help everyone. This looks much better than my clumsy assembly of scripts.[/quote]

    Jason as far as I know scheduled tasks are only visible to the user logged in if that user is also the user the task is set to run as. To schedule the shutdown task and have it visible you can use pstools to run the shutdown.hta remotely by either saving the hta to an accessible network share or saving it on the local workstation and then using psexec from pstools to execute the .hta. If you want some more detailed instruction on how to do this let me know.

  3. Hello everyone. I am having trouble scheduling this .hta to run in Windows 7. I can run it successfully by double clicking the hta iteslf, and I can run it from command line using mshta.exe “C:scriptsshutdownshutdown.hta”. Unfortunately, when I schedule the task to run using a domain account (my end users dont have permission to create scheduled tasks) the hta will not display. The mshta.exe process is running in Task Manager, and if I leave it alone, it WILL restart the computer in 10 minutes, but I never get the display or the warning beeps. Any ideas?

    Thanks for the help everyone. This looks much better than my clumsy assembly of scripts.

  4. Updated 05 Feb 2012:

    Please note, this HTA application was updated with the following changes:

    [list][*] Improved countdown – now runs smoothly, says ‘minutes’ if there are 2 or more minutes remaining, says ‘minute’ if one minute remaining, and only says ‘seconds’ if in the last 60 second count down.
    [*] When ran the window is placed on top of all open windows
    [*] When the 60 second count down sarts the window is placed on top of all open windows
    [/list]

    A special thanks to Dave (see comments) for helping improve the countdown.

Leave a Comment

Your email address will not be published. Required fields are marked *