Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What script disables the night light settings? #54

Closed
AdamJel opened this issue Feb 3, 2021 · 13 comments
Closed

What script disables the night light settings? #54

AdamJel opened this issue Feb 3, 2021 · 13 comments
Labels
bug Something isn't working

Comments

@AdamJel
Copy link

AdamJel commented Feb 3, 2021

Hello,
I used this script generator to harden privacy on my Win machine. I also tried to remove as much bloatware as possible. I am overall happy except for one thing. The Windows settings of night light is inaccessible.

Do you know, which script could have disabled this feature and what would be his reverse form?

Thank you

@undergroundwires undergroundwires added bug Something isn't working help wanted Extra attention is needed and removed help wanted Extra attention is needed bug Something isn't working labels Feb 4, 2021
@undergroundwires
Copy link
Owner

Hi @AdamJel , glad to hear that you're happy and thanks for the bug report. Would you be able to specify your OS version? Did you run standard/script or something customized? Could you upload the script if it was something customized?

@AdamJel
Copy link
Author

AdamJel commented Feb 5, 2021

@undergroundwires luckily, I am able to catch on your message editing going on :)

@undergroundwires
Copy link
Owner

Hi, sorry for the inconsistent replies, I was testing meanwhile and getting different result 😅 Thanks for the all information.

I tested it on 20H1 but could not reproduce, however I could reproduce it using 20H2 and "Strict" template after rebooting.

Behavior is unintended and I'm not sure what script is causing it. 🤔

@undergroundwires undergroundwires added the bug Something isn't working label Feb 5, 2021
@undergroundwires undergroundwires added the help wanted Extra attention is needed label Feb 18, 2021
@undergroundwires
Copy link
Owner

I suspect this is caused by disabling a service that interacts with the night light settings in an undocumented way. #55 (comment) by @mikhoul might solve it. Please share if anyone can find out what's the cause here, so we can unrecommend or document the script.

@mikhoul
Copy link

mikhoul commented Feb 27, 2021

There are 3 Windows services necessary for night lighting to work properly:

  • Connected Devices Platform User Service (CDPUserSvc)

  • Connected Devices Platform Service (CDPSvc)

  • Network Connection Broker (NcbService)

If the "Connected Devices Platform Service" and "Network Connection Broker" services have the "disabled" start type, the "night lighting" functionality in the "Settings" application does not work, if we click on the button for the activate, nothing happens. For the night lighting setting to work, these services can be configured with the "manual" or "automatic" start type with the service management console (services.msc).

The "Connected Devices Platform User Service" service must be configured with the "automatic" start type for night lighting to work. This service (called "template service") create a secondary service (called "Per-user service") with the same name followed by a random hexadecimal number (ex: Connected Devices Platform User Service_253cb) when a user log in (source: https://docs.microsoft.com/en-us/windows/application-management/per-user-services-in-windows).

This service cannot be configured with services.msc, so you must modify its configuration with the Windows registry by executing these commands in Administrator:

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CDPUserSvc" /v Start /t REG_DWORD /d 2 /f

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CDPUserSvc" /v UserServiceFlags /t REG_DWORD /d 3 /f

Setting the value "Start" to 2 configures the type of start to "Automatic".

Setting the value "UserServiceFlags" to 3 allows the creation of the service per user.

When a user log in, the created per-user service inherits the configuration parameters from the service template. So, if the value "Start" of the template service is 2, the service per user created will have the same value "Start" to 2.

After applying these settings, restart the computer and test the night lighting again.

Source: https://answers.microsoft.com/en-us/windows/forum/all/cant-use-windows-night-light-feature/a7372273-ef97-490e-a65e-5a73d714348c

@usamac
Copy link

usamac commented Apr 2, 2021

Hello @mikhoul

I am having this issue after running Standard with some modifications. I have removed EDGE, MS Edge, OneNote & One Drive. There may be one other thing I allowed it wanted to remove that I cannot recall.

I am on 20H2 with Build 19042.906 and Windows Feature Experience Pack 120.2212.551.0.

After running the script, I restarted my system. Then I happened to notice that Night Light was broken. (I use it famously on all of my systems.)

Via your instructions above, searched the services.msc and found both of the aforementioned "Connected Devices Platform Service (CDPSvc)" which was set to Automatic (Delayed Start) and "Network Connection Broker" was set to Manual (Trigger Start). Both were currently Running.

"Connected Devices Platform User Service" was set to Automatic and it was Running.
So, I opened properties and toggled it to Automatic, applied, closed and restarted my system. Once loaded in I checked and Night Light was still greyed out.

I went back into check what they were showing in service.msc and found that "Connected Devices Platform User Service" was no longer even present in any way.

At this point I opened cmd in admin and ran the two lines one at a time just as you posted above. Both ran successfully.
I then restarted and once loaded in found that Night Light was still greyed out. I then searched for Night Light setting to check if I had any options there.

services.msc still does not show "Connected Devices Platform User Service" at all.

Could you provide any other suggestions? It is strange because I have run a very similar script on work devices and while I left OneNote, Drive and Edge enabled, there are no other differences in these two scripts. Work machines are not losing Night Light.

privacy-script personal.zip

@mikhoul
Copy link

mikhoul commented Apr 2, 2021

services.msc still does not show "Connected Devices Platform User Service" at all.

Make sure that the CDPUserSvc.dll file exists in the %WinDir%\System32 folder. If this file is missing you can try to restore it from your Windows 10 installation media.

@usamac
Copy link

usamac commented Apr 2, 2021

I believe it is installed, right?

Screenshot 2021-04-02 191234

@mikhoul
Copy link

mikhoul commented Apr 3, 2021

Verify that the DDL is registred: https://helpdeskgeek.com/how-to/register-dll-file-in-windows/

Once registered set the service to automatic and reboot so see if the service is started.

@usamac
Copy link

usamac commented Apr 4, 2021

Thank you. I did this and then it disappeared again after reboot. I ended up running sfc /scannow and it restored my Night Light. Searching through the logs.. Unsure so far, but I am wondering if this enabled my telemetry back as well though?

@AdamJel you may want to try this if you are still without your Night Light.

@undergroundwires
Copy link
Owner

I found this out after some extensive testing. It's Microsoft AAD Broker Plugin script. Uninstalling it breaks night light settings after reboot. Reverting the script and rebooting solves the issue.

Also breaks on Windows 10 21H1 and Windows 11 - 21H2.

I don't know why night light setting would require Azure Active Directory connection. High likely that some data collection is involved.

@undergroundwires undergroundwires removed the help wanted Extra attention is needed label Nov 20, 2021
@usamac
Copy link

usamac commented Nov 21, 2021 via email

undergroundwires added a commit that referenced this issue Dec 25, 2021
- Document breaking of night light settings (#54).
- Document breaking of language selection from taskbar (#24).
- Unrecommend from strict pool.
@undergroundwires
Copy link
Owner

Closing this as the setting is now unrecommended and documented. Feel free to create new issues for further problems/ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants