locked
shutdown/reboot after user logoff RRS feed

  • Question

  • i am trying to make a scheduled task that shuts a computer down and restarts after every user logoff. in the scheduled task wizard i have the trigger as "on disconnect from user session" "any user" "connection on local computer"

    i just have shutdown.exe with the -r switch.

    what gives?
    Monday, March 8, 2010 8:49 PM

All replies

  • i am trying to make a scheduled task that shuts a computer down and restarts after every user logoff. in the scheduled task wizard i have the trigger as "on disconnect from user session" "any user" "connection on local computer"

    i just have shutdown.exe with the -r switch.

    what gives?
    Edwin,

    This is a problem for you because the shutdown command in Windows essentially uses the ExitWindowsEx() API function to restart the computer. 

    There is more described here under the heading of "Troubleshooting" - it relates to the computer being unlocked - but I would expect the logged off state provides a similar lack of interactivity to the shutdown utility.:


    Knowing what you're after here - I'm not clear on the best way to actually make this happen - it may be through the use of a group policy or a third party application. If you do get it figured out I would love to know how.

    Thanks,


    Kevin Costain
    @calwell on Twitter
    Calwell's Blog
    Google Profile (Buzz)
    Tuesday, March 9, 2010 3:19 AM
  • Hi,

    Why won't you set the only option to reboot\restart and make"logg off" gray out from shut down botton?

    Open your registry and find or create the key below.

    Create a new DWORD value, or modify the existing value, called "NoLogOff" and set it according to the value data below.

    Exit your registry; you may need to restart or log out of Windows for the change to take effect.
     
    [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\
    Explorer]

    Tuesday, March 9, 2010 10:10 AM
  • Hi,

    Why won't you set the only option to reboot\restart and make"logg off" gray out from shut down botton?

    Open your registry and find or create the key below.

    Create a new DWORD value, or modify the existing value, called "NoLogOff" and set it according to the value data below.

    Exit your registry; you may need to restart or log out of Windows for the change to take effect.
     
    [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\
    Explorer]


    well the plan was to have an auto logoff after a timeout period, so disabling logoff wouldn't seem like a good option. i wanted timeout logoff->restart->etc. that was all automated.

    i wanted to do a timeout logoff->restart->auto boot into recovery to get a command prompt for diskpart/bcdedit->write a script to delete->recreate an differencing disk back to a parent vhd file->restart into the differencing disk natively.

    this would effectively put the system back to a prior state using differencing vhd files, but it seems like a huge pain considering i can't even get the automated logoff->force restart done.
    Thursday, March 11, 2010 6:25 PM
  • Well there might be a long workaround.

    First, enable the Automatic Restart

    Using Registry Editor:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl

    DWORD = AutoReboot

    0 = Auto Restart Disabled

    1 = Auto Restart Enabled


    Not using Registry Editor:

    System Properties - Advanced - [Startup and Recovery]Settings

    Remove the checkmark from "Automatically Restart" in the System Failure section.

    Then you need to manually create a timeout crash.

    EG:
    1. Start regedit. (If you are unfamiliar with regedit, please refer to this FAQ)
    2. Navigate to:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters
    3. Create a new DWORD value and name it CrashOnCtrlScroll
    4. Right-click on this newly created value and click on Modify
    5. Enter 1 in the Value data field and click on OK.
    6. Close regedit and reboot your system.
    7. Now you can crash your system by holding the right CTRL key and pressing "Scroll Lock" twice.

    Monday, March 15, 2010 10:48 AM
  • Well there might be a long workaround.

    First, enable the Automatic Restart

    Using Registry Editor:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl

    DWORD = AutoReboot

    0 = Auto Restart Disabled

    1 = Auto Restart Enabled


    Not using Registry Editor:

    System Properties - Advanced - [Startup and Recovery]Settings

    Remove the checkmark from "Automatically Restart" in the System Failure section.

    Then you need to manually create a timeout crash.

    EG:
    1. Start regedit. (If you are unfamiliar with regedit, please refer to this FAQ)
    2. Navigate to:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters
    3. Create a new DWORD value and name it CrashOnCtrlScroll
    4. Right-click on this newly created value and click on Modify
    5. Enter 1 in the Value data field and click on OK.
    6. Close regedit and reboot your system.
    7. Now you can crash your system by holding the right CTRL key and pressing "Scroll Lock" twice.


    that still requires user input. remember this is supposed to logoff after a period of inactivity or by logoff, not by user input.

    winexit scr from the 03 server resource kit tools accomplished this but doesn't seem to work with windows 7. i am still messing around with just trying to create a scheduled task to do the same function but haven't been successful yet.

    Tuesday, March 30, 2010 9:06 PM
  • Any chance you figure out a solution?

    I get the restart but only after ~20 second delay when user click the logoff, which is quite frustrating. This was using gpedit.msc.

    Monday, July 16, 2012 11:06 PM