1.    15 Aug 2017 #1
    Join Date : Aug 2017
    Posts : 2
    Windows 10

    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 ComputerSystem Spec
  2.    16 Aug 2017 #2
    Join Date : Aug 2017
    Posts : 2
    Windows 10
    Thread Starter

    Updates


    Hey,

    Any update on this?
      My ComputerSystem Spec
  3.    16 Aug 2017 #3
    Join Date : Oct 2014
    Trnava
    Posts : 2,862
    Windows 10.4 Home 1709 x64

    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.
    Attached Thumbnails Attached Thumbnails capture_08162017_225019.jpg   capture_08162017_225008.jpg  
      My ComputerSystem Spec
  4.    16 Aug 2017 #4
    Join Date : Oct 2016
    Posts : 322
    seL4

    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 ComputerSystem Spec

 


Similar Threads
Thread Forum
Scheduled Task not waking up PC.
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...
General Support
Windows Defender Default Scheduled Task - Looking For Information
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...
AntiVirus, Firewalls and System Security
Windows 10 Home Shutdown Script
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...
Customization
Odd scheduled task
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...
AntiVirus, Firewalls and System Security
Solved Build 10074 Windows Defender scheduled task scans ?
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...
AntiVirus, Firewalls and System Security
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 16:39.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums