GithubHelp home page GithubHelp logo

adltech979 / disable-scheduledwaking Goto Github PK

View Code? Open in Web Editor NEW

This project forked from seagull/disable-scheduledwaking

0.0 0.0 0.0 21 KB

PowerShell script for Windows 10+ devices that aims to stop Windows waking the system automatically.

PowerShell 100.00%

disable-scheduledwaking's Introduction

seagull's Scheduled-Task Wake Disabler

How do I download/run this? Scroll to the "Installation" section.

Windows 10 and onward were designed with a much more heavily-handed approach to updates than previous iterations. Perhaps as a response to the masses refusing for months to reboot their systems and then blaming the company when they get hit by exploits, MS have removed a lot of options from Windows Updates' user experience. This process of dragging users kicking and screaming into responsibility has created an unfortunate by-product in a series of scheduled tasks that will wake a device up in order to install updates if it knows any are due.

I believe power users should have sole authority of when their devices sleep and wake, and I have some background on the topic, so it seemed like time I put my scripting skills to use and created a simple way to automate the process of disabling automatic wakes-up for good.

How it works

This script has been re-written entirely from its December 2018 iteration. Thanks to some streamlined code courtesy of @freMea, I have done away with all of the arsing around in PSExec and editing scheduled tasks directly by their XML. Instead, the script simply enumerates all scheduled tasks on the system โ€“ either the ones specific to Microsoft Update or broadly across the entire system โ€“ with the ability to wake the device up at their leisure, and puts the control of that permission back in the rightful hands of the user. In order to accomplish this the tasks have their ownership seized to be made the property of the user running the script.

What it does

It uses get-scheduledTask to enumerate all enabled tasks on the device with the WakeToRun privilege, using icacls and takeown to make them the property of the person running the script. This is not dissimilar to what the older script did but the process now incurs significantly less of a headache. If the user chooses so, a list containing the tasks can be produced without doing anything to them; alternatively, they are iterated through and their privileges to wake the system are revoked.

Installation

The script does not need to be installed; it is a script. Download the .ps1 file visible in the project files above as a raw file from GitHub and move it to your Desktop. You will probably need to allow PowerShell to execute it first, so right-click the Start Menu and select "Windows PowerShell (Admin)" or "Windows Terminal (Admin)". In the box that appears type Set-ExecutionPolicy Unrestricted and then select A (or Y if there is no A option) to the prompt. To run the script, right-click it on your Desktop and select "Open with PowerShell". It won't do anything without telling you first.

The script closes immediately after launching/I receive 'Missing file specification after redirection operator' errors
That means you right-clicked the .ps1 file and selected "Save Target As". Don't do that! Click through to the .ps1 file above, then click "raw" in the top-right. Save the page that loads in as your .ps1 file instead. You downloaded an HTML document before.

Acknowledgements

This script uses some logic from @freMea who left a very helpful comment in the issues of the original script. It has been tested on Windows 10 and Windows 11, English and German. You really shouldn't need to run it on anything earlier than Windows 10, but it will allow you to if you insist.

Guarantee

I attach no guarantee of functionality to this script. Use it at your own risk.
If you bollocks up your system from using this I won't be held responsible.

Feedback

Did this script work strangely on your system or cause problems? File an issue.
Did everything work perfectly? Follow me on Twttr. (I don't post and won't reply to messages.)

disable-scheduledwaking's People

Contributors

seagull 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.