Giter Club home page Giter Club logo

win10activehours's Introduction

If this helps you, don't forget to leave a Github Star and upvote at StackOverflow https://superuser.com/a/1456571/351521

Win10ActiveHours

You can control the time which you allow Windows to automatically reboot per Windows Update operations without disabling anything or forcefully stopping the Windows Update service.

This script will not prevent any Windows Updates from being downloaded or installed ever so OS security patches will still be applied to the system ― you just have it reboot when you're ready.

Contributing

Pull requests and Issues are welcome!

If this project is useful to you, don't forget to leave a Github Star

You can also Buy me a coffee

How to use

  1. Download the setup.ps1 script

  2. Open PowerShell as Admin

  3. Navigate to the downloaded script directory

  4. Run Unblock-File .\setup.ps1

  5. Run Set-ExecutionPolicy RemoteSigned -Scope Process

  6. Commands:

    • .\setup.ps1: install the scheduled task
    • .\setup.ps1 -run: manually executes the scheduled task
    • .\setup.ps1 -uninstall: uninstall the scheduled task

How to verify the current Active Hours

  1. Press Win or click on the Start Menu

  2. Type Active Hours and click Change active hours

  1. The current settings are displayed below Change active hours

How it works

This scripts is based in this answer from StackOverflow: https://superuser.com/a/1208866/351521

This script creates a scheduled task that dynamically sets the Active hours settings for Start time and End time based on the run time it's executed while ensuring to increment the values to always be hours ahead.

The task will be created at \Win10ActiveHours\Update

There are two Active Hours windows of 18 hours:

  • from 18:00 to 12:00
  • from 06:00 to 00:00

There are four triggers that will active the tasks and switch between the two windows:

  • at computer start up
  • at computer wake up
  • daily at 06:00
  • daily at 18:00

These are the settings for the task:

  • wake to run
  • start when available
  • don't stop on idle end
  • allow start if on batteries
  • don't stop if going on batteries

win10activehours's People

Contributors

marcosbozzani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

win10activehours's Issues

Stopped working on Windows 10 Pro 20H2

I'm really not sure why it's not working any more. I don't see anything in Event Viewer that tells me why Windows is ignoring my active hours or to indicate that the active hours are not set correctly by this script.

For what it's worth, (for anybody who finds this with the same problem) I ended up finding another solution to Microsoft's stupid update features using the group policy editor: https://www.askvg.com/how-to-change-windows-update-settings-when-managed-or-disabled-by-system-administrator/

I'll follow up with a comment if it ends up not working either.

Register-ScheduledTask : The parameter is incorrect

The task will not register running in an elevated powershell session on Windows 10 Enterprise. Full error Details:

Register-ScheduledTask : The parameter is incorrect.
(32,8):UserId:
At D:\win10activehours\setup.ps1:63 char:5

  •   Register-ScheduledTask $TaskName $TaskPath @options | Out-Null
    
  •   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + Category Info                  : InvalidArgument: (PS_ScheduledTask:Root/Microsoft/...S_ScheduledTask) [Register-ScheduledTask], CimException
    + FullyQualifiedErrorId : HRESULT 0x80070057,Register-ScheduledTask
    

Can't run

I assure you I am running powershell as an admin. I've even tried domain admin.
I keep getting the following and I am not sure why.
PS D:> .\setup.ps1
Register-ScheduledTask : Access is denied.
At D:\setup.ps1:63 char:5

  • Register-ScheduledTask $TaskName $TaskPath @options | Out-Null
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : PermissionDenied: (PS_ScheduledTask:Root/Microsoft/...S_ScheduledTask) [Register-Schedul
      edTask], CimException
    • FullyQualifiedErrorId : HRESULT 0x80070005,Register-ScheduledTask

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.