Windows 8 How to keep windows off?

Kucklas

Member
Hey!
I am looking for a way to get windows / computer to be turned off on schedule so kids can not play games all night long, must also keep the computer shutdown / locked for a certain time
Are there any ready-made program with pass word, or is there something built in windows I can use?
 
While there isn't really a way to keep the computer from powering on, I have come up with a script that will check the time and based on your settings the script will shut the computer down. The script is pretty basic but it could easily be expanded.
First you need to allow powershell scripts to run for this...
  • Press the Windows key and type powershell, right click Windows Powershell and select run as administrator
  • Type Set-ExecutionPolicy -Scope LocalMachine
  • Close Powershell.
  • Launch Windows Powershell ISE (press the Windows key and type powershell)
  • Copy the following code into the top section and save it to your desktop. I named it Restrict-Computer.ps1
Code:
$restriction_file = "C:\Windows\restrict.txt"

$restrictions = Get-Content -Path $restriction_file
$before = $($restriction[0].Split(":"))[1]

$after = $($restriction[1].Split(":"))[1]

While($true)
{
    If ($(Get-Date).Hour -lt $before)
    {
        shutdown.exe -s -f -t 1
    }
    elseif ($(Get-Date).Hour -gt $after)
    {
        shutdown.exe -s -f -t 1
    }
    else
    {
        Start-Sleep -Seconds 300
    }
}

Now create a file on your destkop called restrict.txt
Add the following two lines to it Change the #'s to the hours you wish to restrict, the computer will run the time between these numbers
in the example below the computer will stay on between 5am - 1059pm
before:5
after:20

  • Now copy restrict.txt and Restrict-Computer.ps1 to C:\Windows
  • Now press the Windows key and type sche and select "Task Scheduler"
  • Click "Create Basic Task..."
  • Give it a name (can be anything)
  • For the Task Trigger select "When the computer starts"
  • For Action choose "Start a Program"
  • For the program type powershell.exe and for the arguments type -f "C:\Windows\Restrict-Computer.ps1"
  • At the Summary page check the box for "Open the properties..." and click Finish
  • Under the General tab click "Change User or Group..." button
  • In the Enter the object type SYSTEM and click check name and OK
  • Change it to run whether a user is logged in or not and run with highest privileges
  • Under the Conditions tab uncheck everything under the Power section
  • Click Ok
Now your computer will power down and won't allow them to use it after hours. Of course if they are tech savvy enough there are ways to defeat this.
 
A w8 machine should have a "family safety" in the control panel... you can set allowed time of day by account but if they learn your password they can still turn it on/ override the lock.
 
Back
Top