Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Release 

Set Logon Time Limits For Any Account in Windows

Hi HF Members,

With this batch script, a logon time limit can be set for any Windows operating system user account.

Code
:: Set Logon Time Limits For Any Account in Windows


@Echo Off

Cls & Color 0E



(Net session >nul 2>&1)||(PowerShell start """%~0""" -verb RunAs & Exit /B)

Cls



:UserName

Echo.
Echo            Specify the UserName that you want to limit  
Echo.
Echo.
Set /p "User=:^> "
Cls
if ["%User%"]==[] Goto :UserName


:_CHOICE

Cls & Mode CON  LINES=11 COLS=80 & Color 0E & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo        1 - Do You Want to Set Time Limit for the User Account: "%User%"    
Echo.      
Echo        2 - Allow the "%User%" Access at all Times.
Echo.


Set /p input=:^>

If Not %input%==1 (Goto :_Ex) Else (Goto :_Enable)

:_Ex
If Not %input%==2  (Goto :_CHOICE) Else (Goto :_Disable)



:_Enable
Cls & Mode CON  LINES=11 COLS=140 & Color 0E & Title Created By FreeBooter
Cls
Echo.
Echo            Specify the times that users are allowed to use the computer.
Echo            You can use 12-hour or 24-hour notation for hours.
Echo            If you use 12-hour notation, use AM and PM, or A.M. and P.M.
Echo            You can use any of these time range using either a 12-hour (3am, 1pm, etc.) or 24-hour (03:00, 13:00, etc.) format.
Echo            You can only use times in one-hour increments, so don't add any minutes to the times.
Echo.
Echo            Type Logoff Hour
Echo.
Set /p Start=:^>
Cls
Echo.
Echo            Type Login Hour
Echo.
Set /p Login=:^>


Net user "%User%" /times:M-Su,%Start%-%Login%



Cls & Mode CON  LINES=11 COLS=60 & Color 0E & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo          Denying User Account "%User%" Access to Windows    
Echo.
Echo.
Echo.
Ping -n 6 localhost >Nul
Exit



:_Disable


Net user "%User%" /time:all

Cls & Mode CON  LINES=11 COLS=70 & Color 0E & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo          Allowing the "%User%" Access to Windows at all Times
Echo.
Echo.
Echo.
Ping -n 6 localhost >Nul





Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by Emre_Jan 12, 2021 11:16 PM 0 139 Jan 12, 2021 11:16 PM
Last Post: Emre_
[Shell] by Emre_Nov 20, 2020 04:40 PM 2 123 Nov 20, 2020 04:40 PM
Last Post: Emre_
[Shell] by Emre_Oct 27, 2020 02:48 AM 3 155 Oct 27, 2020 02:48 AM
Last Post: VisualSoft