Windows OS Hub
  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux

 Windows OS Hub / Windows 11 / Restrict the Allowed Logon Time for Local Users on Windows

January 3, 2025 Windows 10Windows 11

Restrict the Allowed Logon Time for Local Users on Windows

The Parental Controls feature in Windows 7 and 8 can be used to limit the allowed logon hours for local user accounts. On Windows 10 and 11, a similar parental control feature (called Microsoft Family Safety) is only available for Microsoft (cloud) accounts. However, you can use built-in tools in Windows to restrict specific local users from logging on to a computer at specific hours and days,

For example, you might want to prevent some local users from logging on to Windows at any time except when allowed (most likely, you are reading this post because you want to limit the time your children spend on the computer 😉 ).

For example, I want to restrict the allowed logon time for a specific Windows user on weekdays from 8:00 to 09:00 and 17:00 to 18:00, and on weekends from 11:00 to 14:00. It is not possible to configure the login time limits using the Windows GUI. However, you can use the net user CLI command with the /times parameter.

Command syntax:

net user <login> /time:<allowed-time>

For my scenario, where I need to allow more than one allowed login time per day, the command would look like the following:

net user benedikt /times:M-F,8:00-9:00,17:00-18:00;Sa-Su,11:00-14:00

net use /times: restrict local user login hours

  • Replace benedikt this with the name of the user account you want to restrict. This allowed hour restriction cannot be enabled for local administrator accounts, so this should be a standard user account.
  • Logon time syntax is limited to whole hours, and you cannot specify time restrictions down to the minute.
  • Allowed weekday abbreviations: M,T,W,Th,F,Sa,Su
  • A day span can be separated by commas or a dash (like, M,T,W or Su-Sa)
  • The command must not contain spaces.

If a user attempts to log into a computer outside of the allowed hours, the following message will appear:

Your account has time limit restrictions that prevent you from signing in at this time. Please try again later.

Your account has time limit restrictions that prevent you from signing in at this time

List the current ‘Logon hours allowed’ settings:

net user benedikt

net user: list logon hours allowed for a local user

Remove all user logon time restrictions:

net user benedikt /time:all

If the user’s allowed hours for working on the computer have expired, you may want to disconnect the user or lock a session. After the logon time expires, the user session is not locked or disconnected by default.

  1. Open the Local Group Policy Editor (gpedit.msc) and go to User Configuration -> Administrative Templates -> Windows Components -> Windows Logon Options
  2. Enable the policy Set Action to take when logon hours expire.
  3. Depending on your needs, in the policy settings, select the action you want to take when the allowed work hours expire. It could be Lock, Logoff, or Disconnect. It is better to lock a session to prevent the user from losing unsaved documents. GPO: Set Action to take when logon hours expire
This configuration can also be enabled through the registry:
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v LogonHoursAction /t REG_DWORD /d 0x1 /F

Now, when the user has one minute left to work, they will be notified and the session will be locked:

Sign-in time restrictions
Your computer will be locked in 1 minutes due to sign-in time restrictions.

Your computer will be locked in 1 minutes due to sign-in time restrictions

So, we covered how to enforce logon time limits and force a user to log out when they exceed a time limit. This is how you can enable some basic parental controls on Windows and limit the amount of time that your children can spend on the computer.

In an Active Directory, the allowed logon hours and days can be enabled in the account settings in the ADUC snap-in.
set logon hours in Active Directory
0 comment
4
Facebook Twitter Google + Pinterest
previous post
Hardware Graphics Acceleration Causes Visual Glitches in Microsoft Office Apps
next post
Enable Automatic System Registry Backup on Windows 10/11

Related Reading

Unable to Map Drive: An extended error has...

May 13, 2025

Map a Network Drive over SSH (SSHFS) in...

May 13, 2025

How to Cancel Windows Update Pending Restart Loop

May 6, 2025

View Windows Update History with PowerShell (CMD)

April 30, 2025

Change BIOS from Legacy to UEFI without Reinstalling...

April 21, 2025

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMware
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Map a Network Drive over SSH (SSHFS) in Windows

    May 13, 2025
  • Configure NTP Time Source for Active Directory Domain

    May 6, 2025
  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025
  • Load Drivers from WinPE or Recovery CMD

    March 26, 2025
  • How to Block Common (Weak) Passwords in Active Directory

    March 25, 2025
  • Fix: The referenced assembly could not be found error (0x80073701) on Windows

    March 17, 2025
  • Exclude a Specific User or Computer from Group Policy

    March 12, 2025
  • AD Domain Join: Computer Account Re-use Blocked

    March 11, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • How to Allow Multiple RDP Sessions on Windows 10 and 11
  • How to Run Program without Admin Privileges and Bypass UAC Prompt
  • Fix: BSOD Error 0x0000007B (INACCESSABLE_BOOT_DEVICE) on Windows
  • Fixing ‘The Network Path Was Not Found’ 0x80070035 Error Code on Windows
  • How to Delete Old User Profiles in Windows
  • How to Install Remote Server Administration Tools (RSAT) on Windows
  • How to Backup and Copy Local Group Policy Settings to Another Computer
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top