windows_10:auto-lock_the_computer_on_a_schedule_e.g._at_bedtime
Windows 10 - Auto-lock the computer on a schedule (e.g. at bedtime)
Create the following xml file:
- lock-session-bedtime.xml
<!-- SPDX-License-Identifier: CC0-1.0 --> <Task version="1.2"> <RegistrationInfo> <Description>Lock session at night.</Description> <URI>\lock-session-bedtime</URI> </RegistrationInfo> <Triggers> <CalendarTrigger> <StartBoundary>2020-01-01T23:45:00</StartBoundary> <Enabled>true</Enabled> <ScheduleByDay> <DaysInterval>1</DaysInterval> </ScheduleByDay> </CalendarTrigger> </Triggers> <Principals> <Principal id="User"> <LogonType>InteractiveToken</LogonType> <RunLevel>LeastPrivilege</RunLevel> </Principal> </Principals> <Settings> <MultipleInstancesPolicy>Parallel</MultipleInstancesPolicy> <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries> <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries> <AllowHardTerminate>true</AllowHardTerminate> <StartWhenAvailable>false</StartWhenAvailable> <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> <IdleSettings> <StopOnIdleEnd>false</StopOnIdleEnd> <RestartOnIdle>false</RestartOnIdle> </IdleSettings> <AllowStartOnDemand>true</AllowStartOnDemand> <Enabled>true</Enabled> <Hidden>false</Hidden> <RunOnlyIfIdle>false</RunOnlyIfIdle> <WakeToRun>false</WakeToRun> <ExecutionTimeLimit>PT0S</ExecutionTimeLimit> <Priority>7</Priority> </Settings> <Actions Context="User"> <Exec> <Command>%WINDIR%\System32\rundll32.exe</Command> <Arguments>user32.dll, LockWorkStation</Arguments> </Exec> </Actions> </Task>
NOTE: Modify the hour and minutes in the StartBoundary to set your own log-out time (the date just needs to be any date in the past).
Take care not to make any other changes to the file.
- Open the Task Scheduler program (use the search field in the Start Menu to find it.)
- Expand the Action menu in the menu bar and select Import task.
- Choose the xml file created above, and click OK.
NOTE The task will be called lock-session-bedtime.
The scheduled time can be changed, or the task can be removed from inside the Task Scheduler as needed.
windows_10/auto-lock_the_computer_on_a_schedule_e.g._at_bedtime.txt · Last modified: 2021/01/21 14:24 by peter