In case someone don'tdoesn't want to set up parental control (someone wantwants to lock the computer from themselves, not their kids), here is another solution useusing only Task Scheduler, which I'm currently using:
- Start menu --> Type "Task Scheduler" --> Open Task Scheduler.
- Create New Task
- Set these properties in the General tab:
- Name: choose a task name
- Check Run only when user is logged on
- In the Triggers tab:
- "New..."
- Beginning the task: On a schedule
- Settings: Daily
- Set the hour you want to turn off your computer
- Check Repeat task every: 5 minutes for a duration of 1 hours (or 8-9 hours, dependdepending on you)
- Check Stop all running tasks at end of repetition duration
- Check Enabled
- OK
- In the Actions tab:
- "New..."
- Action: Start a program
- Program/script: powershell.exe
- Add agurmentargument: -command add-type -assemblyname System.Windows.Forms; [System.Windows.Forms.Application]::SetSuspendState([System.Windows.Forms.PowerState]::Suspend, $false, $false)
- In the Conditions tab:
- Uncheck everything
- In the Settings tab:
- Uncheck everything
This schedule will sleepput your computer to sleep at the chosen time. If you try to turn the computer back on, it will continue to sleep every 5 minutes (in 1 or 9 hours - dependdepending on your setup). This sleep action cannot be preventprevented. The computer went sleep, not turn off, so no worry about unsaved work.
Note: there is no warning display before the computer gogoes to sleep. You can create another Task Schedule to remind you of sleep time.