Night Light/Dark Mode Task Scheduler

Anonymous
2020-09-01T13:44:26+00:00

What I'm trying to achieve is really quite simple.

I want to create 2 tasks:

  1. When I turn on the night light, dark default app mode is enabled
  2. When I turn off the night light, light default app mode is enabled

I don't really have any experience with creating tasks in Task Scheduler so I'd appreciate some pretty in-depth help

Thanks :)

Windows for home | Windows 10 | Settings

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

11 answers

Sort by: Most helpful
  1. Anonymous
    2020-09-01T14:58:38+00:00

    I don't really have any experience with creating tasks in Task Scheduler so I'd appreciate some pretty in-depth help

    Creating a scheduled task is easy. What might be harder is to find a command that turns the dark mode on or off. If you can find it, e.g. with a Google search, pleaser post it here. You should also tell the forum how Windows knows when you turn on the night light.

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2020-09-01T15:01:24+00:00

    Hi and thanks for reaching out. My name is William. I'm a Windows technical expert. I'll be happy to help you out today.

    There is an article that outlines creating a scheduled task to automatically turn these on/off at specific times here: https://www.windowscentral.com/how-automaticall...

    But from the sounds of it, you are looking to do this manually. The problem here is that there is no way to setup a trigger on number 1 if done manually. The change to enable or disable the night light is implemented in the registry (in this case, Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\CloudStore\Store\DefaultAccount\Current\default$windows.data.bluelightreduction.bluelightreductionstate\windows.data.bluelightreduction.bluelightreductionstate).

    That said, technically, this is possible, but is a bit convoluted to set up. What you would so is enable auditing on the registry key above, enable audit policy*, create a task that is triggered on the event generated by registry audit success Event ID 4657 in the Security log that will fire PowerShell commands to set-item property n step 14 in the linked article. I can walk you through the exact steps to try and get this working if that is an approach you want to take.

    *If you are using Windows 10 Home, you cannot access group policy editor to enable registry key auditing. You would need to instead use auditpol command to turn it on (elevated command prompt): Set-Itemauditpol /set /subcategory:"registry" /success:enable

    2 people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2020-09-02T04:47:28+00:00

    So from what I was able to gather, I can use the following PowerShell command to turn on dark mode:

    New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0 -Type Dword -Force

    But the issue is getting Windows to trigger at the action of turning on the night light.

    And I assume I can just do the opposite for light mode.

    0 comments No comments
  4. Anonymous
    2020-09-02T04:51:24+00:00

    Hi William, thanks for that! If you were able to walk me through the steps that would be amazing. And I'm running Windows 10 Pro if that helps at all.

    One thing I do want to make clear though is that I'm only looking to change the 'default app mode,' not the 'default system mode.'

    Cheers

    0 comments No comments
  5. Anonymous
    2020-09-02T05:12:56+00:00

    create a task that is triggered on the event generated by registry audit success Event ID 4657 in the Security log that will fire PowerShell commands to set-item property

    So I've managed to enable auditing on the registry key, and I'm clear on what to do for the 'action' event in Task Scheduler, now the only thing left is how to create the 'trigger' event.

    0 comments No comments