No announcement yet.

An After-30-minute shutdown script

  • Filter
  • Time
  • Show
Clear All
new posts

  • An After-30-minute shutdown script

    Hello dear friends:
    I have newly got a job some where as a network administrator.Based on some policies I have to set a script that shuts down clients after they worked with their computers after 30 minutes.I don't know how to write this script.Please help me.I appreciate your help.

  • #2
    Re: An After-30-minute shutdown script

    I can't imagine why you would want to do this but here you go:

    sleep 1800
    shutdown /s


    • #3
      Re: An After-30-minute shutdown script

      Originally posted by joeqwerty View Post
      I can't imagine why you would want to do this but here you go:

      sleep 1800
      shutdown /s
      In the startup script sample above "sleep" is by default not available as a batch statement. (It is available in vbs though, where the time is in milliseconds).

      Try this batch as a startup script:
      @echo off
      >"%temp%.\wait.vbs" echo\wsh.sleep wsh.arguments(0)*1E3
      (set wait=wscript.exe "%temp%.\wait.vbs")
      %wait% 1800 Seconds
      shutdown.exe /s /f 
      note: This startscript sample will only work when the computer configuration policy "Run startup scripts asynchronously" is Enabled.
      And "Run startup scripts visible" should be Disabled.

      For a user logonstript: Users do not have privileges to execute shutdown.exe, but you can use shutdown.vbs instead and adjust that script a bit by adding the sleep function or an other kind of timer.
      Note: For this option, when launching it as logonscript you'll just should Disable "Run logon scripts synchronously" (or else, it is also possible to use the logonscript to just copy the shutdown script to the HKCU\..\RUN subkey or the Startup folder of the user).

      You could notify the user of this automatic shutdown via a logon message:


      This posting is provided "AS IS" with no warranties, and confers no rights.


      ** Remember to give credit where credit's due **
      and leave Reputation Points for meaningful posts