Skip to content

Instantly share code, notes, and snippets.

@Nevember
Last active October 24, 2022 09:35
Show Gist options
  • Save Nevember/998ed96f17be93b4c6d57f9945478be4 to your computer and use it in GitHub Desktop.
Save Nevember/998ed96f17be93b4c6d57f9945478be4 to your computer and use it in GitHub Desktop.
Enable "Light Mode" at 6:30am daily using this Windows Task Scheduler XML file
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2022-10-23T19:30:00.0000000</Date>
<Author>SCI\SpiralChaotic</Author>
<URI>\SCI\LightModeEnable</URI>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<StartBoundary>2022-10-23T06:30:00</StartBoundary>
<Enabled>true</Enabled>
<ScheduleByDay>
<DaysInterval>1</DaysInterval>
</ScheduleByDay>
</CalendarTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>%ComputerName%\%Username%</UserId>
<LogonType>S4U</LogonType>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
<Priority>7</Priority>
<RestartOnFailure>
<Interval>PT1M</Interval>
<Count>3</Count>
</RestartOnFailure>
</Settings>
<Actions Context="Author">
<Exec>
<Command>%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe</Command>
<Arguments>-NoProfile -NonInteractive -ExecutionPolicy Unrestricted $RegPath = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize'; New-ItemProperty -Path $RegPath -Name SystemUsesLightTheme -Value 1 -Type Dword -Force; New-ItemProperty -Path $RegPath -Name AppsUseLightTheme -Value 1 -Type Dword -Force</Arguments>
</Exec>
</Actions>
</Task>
@Nevember
Copy link
Author

Nevember commented Oct 24, 2022

Usage:
See the comments for this gist's partner, Dark_Mode_Enable.xml, which I recommend using in conjunction with this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment