Disassembler0 / Win10-Initial-Setup-Script

PowerShell script for automation of routine tasks done after fresh installations of Windows 10 / Server 2016 / Server 2019
MIT License
4.7k stars 1.08k forks source link

Add an option to prevent waking up computer out of active hours #240

Closed entdark closed 5 years ago

entdark commented 5 years ago

Is there such an option already? I couldn't find.

Manually it's possible through this: https://superuser.com/questions/973009/conclusively-stop-wake-timers-from-waking-windows-10-desktop There is also a PS script in the second answer.

Disassembler0 commented 5 years ago

One of the two registry keys is already in DisableUpdateRestart tweak, however the other seems to be equally important, so I'll add it too.

Disassembler0 commented 5 years ago

Added. The tweak is now called DisableMaintenanceWakeUp.


And because somebody will eventually ask why I have removed the original DisableUpdateRestart in favor of this, I'm gonna answer right away:

The tweak was largely ineffective in its previous state. The NoAutoRebootWithLoggedOnUsers value works only when the automatic maintenance (including the nighty tasks) is enabled and update installation times are schedulled, which is something most users of this script don't want. If there happens to be somebody who wants to have scheduled updates and NoAutoRebootWithLoggedOnUsers, then following needs to be applied:

Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" -Name "NoAutoRebootWithLoggedOnUsers" -Type DWord -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "NoAutoRebootWithLoggedOnUsers" -Type DWord -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "NoAutoUpdate" -Type DWord -Value 0
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUOptions" -Type DWord -Value 4
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AutomaticMaintenanceEnabled" -Type DWord -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "ScheduledInstallDay" -Type DWord -Value 0
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "ScheduledInstallTime" -Type DWord -Value 2
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AllowMUUpdateService" -Type DWord -Value 1

Source: https://superuser.com/questions/1066441/is-noautorebootwithloggedonusers-still-supported-effective-on-windows-10