How to Set Logon Hours and Control User Logon Time in Windows XP

Have you ever wondered how-to restrict unauthorized members to access your PC/network or have you been using costly software to restrict your children from logging to your PC at odd times?? If the answer is yes, then here is a solution for you that lets you set Logon hours to your PC so that you can set limits on the times a certain user account is able to logon to your computer. This tweak work for all PC’s running on Windows XP.

This can be done in DOS with the use of simple yet wonderful DOS command “net user”

Let me give you a brief intro about NET USER command. NET USER is a command used in the command console to create and modify user accounts on computers.

To do this you should have Admin privileges. Now, let us know how-to modify a user account by setting logon hours.

1)Goto Start–>Run… type cmd or command to get command prompt.

2)If you want the user account for the computer to be listed
type net user without command-line switches and press enter
(see below image. Click to enlarge) net user command Let us know about user accounts listed..

Administrator and Guest are Built-in accounts used for administering and guest access to the computer/domain respectively.

Help Assistant is the Account For Providing Remote Assistance.

SUPPORT_xxxxxx is the vendor’s account for the Help and Support Service.

By default you will be having all the above user account. Besides these, you can create other user accounts with your desired user names as you would do.

VUSR_RAMARAOBOBBY which can be seen in the image above is the
Account for the Visual Studio Analyzer server components. As I would do Visual Basic programming I got that account listed as well.

3) Now let’s learn how-to set logon hours for a user account (say guest) taking an example. If you wanna do it for other accounts type that user name in place of guest in commands below.

At the command prompt when you type as below:

net  user  Guest  /time:M-Su,8am-10am

you made the Guest account to logon only between 8am-10am daily.(coz we have give interval as M-Su)

Day codes are as follows:
Monday – M
Tuesday – T
Wednesday – W
Thursday – Th
Friday – F
Saturday – Sa
Sunday -Su
(as DOS is not case sensitive you can use small or capital letters)

Hours can be mentioned 12-hour or 24-hour notation. For 12-hour notation,use am, pm. While representing time in 24-hour notation use as 08:00 – 10:00

Note: Only sharp values are accepted for time and separate day and time entries with a comma.

4) To set logon hours at different times for the same day use ; as separator.
and to set logon hours at different times for different days use : as separator.

For example, if you want to set logon hours between 8am-10am and 2pm-5pm daily then type the command as follows:

net user /time:M-Su,8am-10am;M-Su,2pm-5pm

likewise if its for different days use : in place of ;

Note: When you have given the command correctly then a message saying The Command Completed Successfully will appear after press enter.

And after setting logon hours when you try to logon outside the time interval given, it asks for a password and wont allow you to logon even though you type the correct password.(as in image below, click to enlarge)

windows logon
5) To disable this feature and make user log-on always type as below:
net user /time:all

6) To restrict the user to never logon use blank in place of all
net user /time:

As I have said earlier the command completed successfully message comes when you typed the command correctly (as shown)

command prompt tricks Try this on your PC and post your comments.

Note: The command can restrict user from logging in but cannot initiate a log off when account is in opened state. And please don’t misuse this Notepad.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top