You are currently viewing How to Set Logon Hours for Windows Local Users Using Command

How to Set Logon Hours for Windows Local Users Using Command

Friend’s Logon hours in Windows allow you to specify the times during which a user account can log on to a computer or server. Configuring the logon hours in Windows or Windows Server for Local users can be useful for several reasons, including security, compliance, resource management, and productivity. (Set Logon Hours for Windows Users Using Command)

From a security standpoint, Limiting the hours in windows prevent unauthorized access to sensitive data or resources. Users can only logged in to their pc or server at a specific time which we have configured in windows or server. As we already discussed by setting the Logon hours we can prevent our PC or Server from unauthorized access. For an example, if any employee or a person leaves their PC or Server unattended, someone else could potentially log on and access confidential information. Similarly, if you have a server that contains sensitive data, you may want to restrict access to authorized users during certain hours to reduce the risk of unauthorized access. By setting logon hours, you can reduce the risk of such incidents.

Steps to Configure Logon Hours in Windows Using “NET USER” Command

You can set logon hours for a Windows or Windows Server local user account using the command prompt by following these steps:

  • Open the command prompt as an administrator.
  • To view the current logon hours for a user, run the following command:
net user <user name>

Set Logon Hours for Windows Users Using Command

  • Replace “username” with the actual username of the user account of your Server or PC.

  • To set the logon hours for a user, run the following command:
net user <user name> /time:M-Saturday,9am-7pm

Set Logon Hours for Windows Local Users

  • Again Replace “username” with the actual username of the user account, and “M-Saturday,9am-9pm” with the desired logon hours.
  • In this example, “M-Saturday” specifies Monday through Saturday, and “9am-9pm” specifies the hours from 9 AM to 9 PM.

  • If you Want to set logon hours for multiple days, separate them with commas. For example:
net user <user name> /times:M,T,W,S,8am-10pm;TH,12pm-6pm

Set Logon Hours for Windows Local Users

  • In this example, the user can log on Monday, Tuesday, Wednesday, and Saturday from 8am to 10pm, and on Thursday from 12pm to 6pm.

  • Once you have set the logon hours according to your requirement, you can verify them by running the first command again:

Set Logon Hours for Windows Users Using Command


  • To allow the user to login at any time OR remove the logon hours restriction for any user, run the following command:
net user <user name> /time:all
  • Once you have remove the logon hours restrictions, you can verify them by running the first command again:

Set Logon Hours for Windows Users Using Command

So Friend’s By Following Above mentioned Steps you can easily Configure Logon hours for any Windows Pc User or any Windows Server Local User.

Leave a Reply