Shutdown machine via scheduled task

Reading Time: < 1 minute

The below script will create a schedule task to shutdown the machine at 17:00 daily with a message of “This computer will shutdown in sixty (60) seconds. Please save your work now.”

Copy the below script into a notepad file and rename to something suitable such as shutdown.bat

If you wish to push out the script add the .bat file to computer startup within your group policy. (You may need to reneter speech marks (“) within the script.


SET strShutdownPath=%SystemRoot%\System32\
SET strShutdownProgram=shutdown.exe
SET strShutdownComment=This computer will shutdown in sixty (60) seconds. Please save your work now.

IF EXIST “%SystemRoot%\System32\schtasks.exe” (
    ECHO Task Scheduler Found, Executing Command…
    SCHTASKS /Create /RU “SYSTEM” /SC “DAILY” /TN “Computer Shutdown” /TR “%strShutdownPath%%strShutdownProgram% -s -t 60 -c \”!strShutdownComment!\” -f” /ST “18:00:00” /SD “20/09/2010”
) ELSE (
    ECHO Task Scheduler NOT Found, Ending Script…

One thought on “Shutdown machine via scheduled task

  1. I decided to do a quick search on Google before the finance director signed off a purchase order for some software which would automatically shutdown machines at a particular time.

    This script works perfectly and saved the company a few hundred.

    I have subscribed to your feeds


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.