Coder Social home page Coder Social logo

monomol / windowsshutdownfromsleep Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 28 KB

Shuts down Windows machine after running for a specific time period.

License: GNU General Public License v3.0

PowerShell 100.00%
powershell powershell-script shutdown shutdown-script shutdown-timer sleep sleep-mode sleep-timer windows

windowsshutdownfromsleep's Introduction

Windows Shutdown From Sleep

This utility uses the task scheduler and PowerShell to enable you to make your Windows machine shut down after sleeping for a specific time.

What does the script do?

File set_shutdown.ps1 listens for changes in the machine's power state. If it registers that the device is about to go to sleep, it sets up a wake-up task with a shutdown as its action. If you wake it up before the task begins, the task gets disabled and won't run.

Created tasks

  • ShutdownSleep is the task responsible for shutting down the computer; it is modified accordingly by set_shutdown.ps1
  • ShutdownSleepDeamon is the task that runs set_shutdown.ps1 on startup (so it can continuously monitor the power state)

Customization

  • Following settings are located in settings.ini (changes are optional, default values are supplied)
  • Delay is the time (in whole minutes) for which the machine has to sleep to be turned off
  • TaskName is used to derive the name of the newly created tasks

Setup

  1. Clone this repository to a desired location
  2. Run setup.ps1 as an administrator

Disclaimer

  • I renounce any responsibility for any damages (most likely loss of your data) caused by my code. I created this with the best intentions, but I cannot guarantee this code works the way intended. Use it at your own risk.
  • This code used to be run manually, and this automated version has not been that thoroughly tested. Feel free to report any bugs you find or propose changes.

windowsshutdownfromsleep's People

Contributors

monomol avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.