An application called ADLogonHours.exe has been developed to document and set the logon hours of
Active Directory and local Windows users. While the VBScript programs LogonHours.vbs and
AllUsersLogonHours.vbs can document the logonHours attribute of Active Directory users, they cannot
be used to assign values. The logonHours attribute of Active Directory users (and the loginHours
attribute of local Windows users) is data type OctetString, which is a byte array. VBScript can read
a byte array and convert it to strings. VBScript can copy the logonHours or loginHours attributes
from one user to another. But VBScript cannot assign values to logonHours or loginHours because it
cannot create or modify a byte array.
The logon hours specify the hours of the week that a user is allowed to logon. In "Active Directory Users and Computers" you can view and modify the settings by clicking the "Logon hours..." button on the "Account" tab. However it is difficult to use this interface to manage the logon hours of many users. The login hours of local users can be managed with the "net user" command and the "/times" switch. Again, this tool is inconvenient if you need to configure many users.
ADLogonHours allows you to manage user logon hours in bulk. The program documents user logon hours to either an Excel spreadsheet or a comma delimited file. The same file formats can be used to set the logon hours for users in bulk.
The ADLogonHours.exe utility is written in Visual Basic 6. VB6 can declare byte arrays. See the links below for more information:
Documentation for ADLogonHours program
Sample Logon Hours Spreadsheet
Sample Logon Hours Comma Delimited File
Click on the link below to download the setup program for ADLogonHours.exe: