HELP! Controllated shutdown batch

Discussion in 'Application Software' started by Miogatto, Nov 26, 2013.

  1. Miogatto

    Miogatto MDL Novice

    Oct 26, 2009
    I have a Windows 7 with C totally (system) encrypted with truecrypt.
    Every day - when I sleep - it executes this batch via Windows planned activities

    C:\Windows\System32\rundll32.exe user32.dll,LockWorkStation

    So even if I could forget to lock the screen, the day after it will be locked.

    But this is not a long-term solution because maybe I cannot come back
    to switch off the computer and somebody could hack the lock-screen or try to
    exploit something via lan.
    I need have it switched off automatically. But only if it stays locked for 4 days.

    This is the reason why I need another script:
    when this second script is run, it should test if I'm not using my computer for
    4 consecutive days and then the script should force my computer to shutdown
    - with no questions/prompts asked, otherwise it will fail.
    after that, my computer will be OFF with truecrypt protecting my documents.

    the script should not shutdown the computer if I am starting to use it after 1 or 2
    days otherwise the unexpected shutdown could interfere with my work.

    How the batch should know if I am using my computer or not?
    I think it should count the days it stays with locked screen and reset the counter
    when the screen is unlocked.

    Any hint? Thanks.
  2. BigW

    BigW MDL Member

    Apr 25, 2010
    Do you realy need to have scripts for this scenario? Arn't the powersettings enough to do this? If you left every powersetting alone the computer locks itselve automaticaly if it's not in use for a time (few minutes I think) and after another 30 Minutes after nothing is done with the computer it powers down in suspended mode. All the times are adjustable to the minute. Another way would be to do it over the task sheduler. (I don't realy know if this is acheavable over the task sheduler.) If my sugestions doen't go far enouth for you, you probatly have to code yourselve a WindowsService with C#, VB, or any other .net-Language.