Cj-tech

Admirable
Jan 27, 2021
534
67
8,940
Hello again!

I am working on a Powershell script to configure some Windows 10 settings for some machines that belong to me and some friends. The changes that I want to make are under Settings > Update & Security > Windows Update > Advanced Options. I can change the "Show a notification when your PC requires a restart to finish updating" and "Download updates over metered connections (extra charges may apply)" options with the below commands in my script.

Code:
# Configure Windows Updates
# 0 - Disabled, 1 - Enabled
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" /v AllowAutoWindowsUpdateDownloadOverMeteredNetwork /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" /v RestartNotificationsAllowed2 /t REG_DWORD /d 1 /f

The problem is with how to turn on "Receive updates for other Microsoft products when you update Windows" and "Restart this device as soon as possible when a restart is required is required to install an update. Windows will display a notice before the restart, and the device must be on and plugged in." I looked into changing it with Group Policy via Powershell but could not find a way to change these two settings.

This thread is the only info I could find in regard to this topic. Any ideas?
 

Ralston18

Titan
Moderator
Why are you using Powershell to edit the registry instead of just using

"Settings > Update & Security > Windows Update > Advanced Options. " directly?

Registry editing is not recommended and should only be a last resort. And attempted only after full system, registry, and data backups.

I would not automate such toggles - some future Windows update may lead to other consequences - likely the bad kind of consequences.....

Between Powershell manipulations and registry tinkering you could easily brick the system.

What is the end purpose or requirement?
 

Cj-tech

Admirable
Jan 27, 2021
534
67
8,940
What is the end purpose or requirement?

Well, it was to automate the process of changing power, display, and update settings.

Registry editing is not recommended and should only be a last resort. And attempted only after full system, registry, and data backups.

So far, I have not changed the registry, but I have already made a backup of my data and registry. The only reason I thought of the registry is because of what was mentioned in the link that is in my original post. I can switch certain settings in Group Policy Editor, but not other settings.

I was mainly wondering how to change the two previously mentioned settings via Powershell.
 

Ralston18

Titan
Moderator
Will second @Colif and @Mandark

You have options although some of the options may be difficult to work out and/or be cumbersome.

And there are always side risks to automation. Something may work for awhile and then some code, parameters, registry, etc. gets changed for whatever reason(s).

Then all goes astray thereafter.

Even just some bad timing with respect to when the registry toggles get changed could wreak havoc. Especially with updates and notifications.

Automation is used to make a routine, repetitious, and possibly tedious manual tasks easier. If you are not going to be toggling the changes on a frequent (subjective) basis then just use the provided means.

Just my thoughts on the matter.
 

Cj-tech

Admirable
Jan 27, 2021
534
67
8,940
Will second @Colif and @Mandark

You have options although some of the options may be difficult to work out and/or be cumbersome.

And there are always side risks to automation. Something may work for awhile and then some code, parameters, registry, etc. gets changed for whatever reason(s).

Then all goes astray thereafter.

Even just some bad timing with respect to when the registry toggles get changed could wreak havoc. Especially with updates and notifications.

Automation is used to make a routine, repetitious, and possibly tedious manual tasks easier. If you are not going to be toggling the changes on a frequent (subjective) basis then just use the provided means.

Just my thoughts on the matter.
Any testing I have done so far has been conducted on a virtual machine, so I am safe from damaging my system. I was more interested in changing it by using group policy, but the only setting that I see in the group policy editor is the option about metered connections.
 
Last edited:

TRENDING THREADS