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.
1)Goto Start–>Run… type cmd or command to get command prompt.
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
(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:
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)
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)
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.