# Windows 10: Windows 10 Shutdown Script through Scheduled task for specific time

1. ## Windows 10 Shutdown Script through Scheduled task for specific time

Hey all,

I have been working on trying to shutdown about 21 lab computers everyday at 11pm through scheduled task with a shutdown script which is as simple as:

REM Shutdown computers at 11;%windir%\system32\shutdown.exe /s /f /t 0 /c "Computer shutting down"

The computers did not shutdown when I tested it for 11.30am.
A few things:

-any parameters that need to be defined for the task to run without interruption from user/system profiles? I have enabled run with highest privileges on domain administrator profile.
-would this be affected if active hours are defined within the system?
-best way to perform this process without any hassle?

Thanks
S
My Computer

2. ## Updates

Hey,

Any update on this?
My Computer

3. What security software do you run? It might be blocking it, also this might help:
Code:
reg add "HKCU\Control Panel\Desktop" /v "AutoEndTasks" /t REG_SZ /d "1" /f
reg add "HKCU\Control Panel\Desktop" /v "HungAppTimeout" /t REG_SZ /d "25000" /f
reg add "HKCU\Control Panel\Desktop" /v "WaitToKillAppTimeout" /t REG_SZ /d "25000" /f
reg add "HKLM\System\CurrentControlSet\Control" /v "WaitToKillServiceTimeout" /t REG_SZ /d "25000" /f

I have just tested it and it works fine.
My Computer

4. First, if you are running a script with domain admin or SYSTEM privileges, please ensure the script is in a place that cannot be accessed by anyone except trusted users.

Second, I would suggest using PowerShell for this instead of a bat file.

Task settings:

Run whether user is logged on or not

Triggers:

Daily, at 11pm

Actions: Start a program
Details:

powershell.exe -ExecutionPolicy Bypass <drive>:\path\to\myscript.ps1

(again please make sure this is in a location that normal users do not have permission access - we don't want them being able to run arbitrary code SYSTEM or a domain admin)

Now in myscript.ps1 simply type:

Code:
Stop-Computer -Force
My Computer

Related Threads
Hello, I have made a scheduled task with the option to wake up the pc from sleep state to run a program. When I tick the option Wake the computer to run this task the computer won't wake up at the given time. I have red in a forum of MS that...
Windows Defender Default Scheduled Task - Looking For Information in AntiVirus, Firewalls and System Security
I'm looking for some information. If your on 1703, using Windows Defender and it's Default Scheduled Scan. The Last Run Results always shows 0x2 (Failed) ... no matter how the action is run (automatic or manual) Could you check your Windows...
Is it possible to run a script on shutdown on Windows 10 Home edition? Group Policy Editor (gpedit.msc) is not available. Already tried to modify registry Execute a script a startup and shutdown Tested successfully on Windows 10 Professional...
Odd scheduled task in AntiVirus, Firewalls and System Security
Hi guys. I found this odd scheduled task named 'UninstallDDS-C960901F-CE14-4DE1-9729-1305F719A337'. The task is set to run at 14:54 on 25/1/16 and then repeat every 00:01:00 indefinitely. The target is C:\Windows\temp\deletefoldertask.exe The...
Build 10074 Windows Defender scheduled task scans ? in AntiVirus, Firewalls and System Security
I installed Build 10074 as a clean install in a VM. I see Windows Defender running a quick scan MANY times per day. I would prefer it run a quick scan once a week. I disabled the built in Windows Defender Scheduled Scan scheduled task. Windows...
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 08:38.
Find Us