Windows 10 Shutdown Script through Scheduled task for specific time


  1. Posts : 2
    Windows 10
       #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. Posts : 2
    Windows 10
    Thread Starter
       #2

    Updates


    Hey,

    Any update on this?
      My Computer


  3. Posts : 5,452
    Windows 11 Home
       #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.
    Attached Thumbnails Attached Thumbnails Windows 10 Shutdown Script through Scheduled task for specific time-capture_08162017_225019.jpg   Windows 10 Shutdown Script through Scheduled task for specific time-capture_08162017_225008.jpg  
      My Computer


  4. Posts : 545
    seL4
       #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 Discussions
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 12:19.
Find Us




Windows 10 Forums