You are here: Home / Computer / Useful Tricks / Computer time limiter

limiting your Computer's hours of operation

"Warning". Before you begin, and as a precaution, make sure that you have at least 2 user log-ins for your computer that are password protected. (See user profile). This will prevent your computer from being locked out.

To control and assign precise time limits on the usage of your computer, you will make adjustments to the windows system, create a ".bat" file, and finally program a task.

Some examples of applications would be to disable the usage of a computer outside the specified hours of operation. This can apply for the office, or perhaps for a child that is allowed on a computer until a certain time.

Information

We will be using the Net User command, and create a file that we will arbitrarily call "ShutdownPC.bat" with which we will use the Shutdown command, and finally we will schedule that task.

The last paragraph describes how to cancel the task.

A - Net User

One method to restrict the access to a computer by a user that we will name JOE between two times of the day (in our example between 04:00 and 17:00 or 5:00PM on every Monday, and for all other week days between 8:00 and 20:00 or 8:00PM) is the following.

Step 1 - Open an MS-DOS window

To open a MS-DOS window via the Run... function, follow these steps:

sg(Left click) on windows start button then cgon Run...

In the Open: field type cmd then cgon OK or press Enter

Step 2 - Net User Instructions

Reminder, the user name that we are restricting in our example is Joe.

Copy the following syntax and paste it in the MS-DOS window.

 

net user Joe /time:M,4:00-17:00; Tu-F,8:00-20:00 

 

command prompt window

To clarify exactly what we are doing: In the example above, Andre is an administrator of the computer currently logged on and password protected, who is limiting Joe's access times to the computer.

That's it for this part. Outside of the above hours, Joe will not be able to log into the computer

The problem that we are left with is that if Joe is already logged on to the computer, the computer will not shut itself off. Hence we will force the computer to shut down.

 

B - Shutdown

We will write a shutdown command by using the windows task manager. Before we proceed, once again make sure that the specified user (Joe) is password protected. To make things simple, we will create an execution file that we will call - ShutdownPC.bat

Step 1 - Creating the ShutdownPC.bat file

To create the file, we will use the notepad, which you can find here:

1- sog(left click) on windows start button

2- Select All Programs

3- Select Accessories

4- sugon Notepad

On the notepad type the following:

shutdown joe -s -f -t 60 -c "PC shutting down"

If your computer has several users, you may have to omit the user Joe, like this:

shutdown -s -f -t 60 -c "PC shutting down"

or

shutdown.exe -s -f -t 60 -c "PC shutting down"

Save this page by doing the following:

sug on the word File (top left corner of the notepad window), then sogon Save and this window will appear :

save as window

To facilitate things, we will save the file directly on the main Hard drive, usually (C:) (See structure of a Hard Drive Disc)

Step 1- sog on the arrow at location 2

Step 2- sog On Hard Drive (C:)

Step 3- sog on the down arrow at location 3 and select All Files

Step 4- Select ShutdownPC.bat at location 4

Step 5- sogon Open

OK we are now ready to give the ShutdownPC.bat file that we created a try, just to make sure that it works.

Just go to windows start button and My Computer and select you hard drive C:

scgon your file ShutdownPC.bat or ShutdownPC (This will depend on whether you chose to see file extensions or not).

Your computer will now shut down in one minute, and while this happens, you will notice that the message "PC shutting down" will appear with the 60 second count down, hence you can change the time as well as the message of your .bat file. (We will see you for phase C after you reboot).

 

Haut 

 

C - Scheduling a task

Step 1 - Opening the task scheduler

To do this, scgwindows start button then scgControl Panel then scgScheduled Tasks

Once there, just scgon Add Scheduled Tasks

This opens up a wizard, scgon Next and then Browse for your ShutdownPC file.

scheduled task wizard 1

 

Step 2 - Scheduling the task

 

Scheduled task wizard 2

 

Scheduled task wizard 3

 

Scheduled task wizard 4

The task scheduler gives you several frequency and time options. In the illustration above, OFFICE/Joe represent the name I gave to my computer (OFFICE), and Joe is of course the user name.

 

D - Canceling the scheduled shutdown

First the scheduled task

Go back to the Scheduled Tasks window. Select the "ShutdownPC" task and then click on Cancel

Now the net user command

Once again open the ms-dos cmd.exe window, and type the following:

net user joe /times:all

then push Enter on your keyboard.