IADsUser Property: LoginHours

Property Name

Property Type

Gets and sets the hours during which a user can log on to the domain. The smallest unit of time for which the property can be set is an hour.

The format of the property is of an array of booleans. The size of the array is 168. Each of these booleans represents an hour on each of the seven days of the week (24 hours X 7 days = 168 flags).

If the boolean flag for a particular hour is set to True then the user is allowed to log on during that particular hour. If it is set to False, the user is not allowed to log on during that particular hour.

The first day of the week is set to Sunday. So, the first 24 boolean flags represent the 24 hours of Sunday starting from 00:00 to 23:00. The next 24 flags would represent the 24 hours of Monday and so on.

The LoginHours property does not distinguish between different months or years. For example, LoginHours cannot be set to allow a user to login in the first week of January and disallow a user to login in the third week of January. But, it can be set to allow a user to login on every Monday and Friday. LoginHours property is not defined for local users.


Dim UserObject As IADsUser
Dim SundayLoginHours(24) As Boolean
Dim LoginHours As Variant
Dim i As Integer
Set UserObject = GetObject("NTDS://DomainName/Username")
LoginHours = UserObject.LoginHours
'Print the login hours for Sunday
For i = 0 To 23
SundayLoginHours(i) = LoginHours(i)
Debug.Print "Login flag for " + Format(i + 1) + " hour = " + Format(SundayLoginHours(i))

Next i


See Also

    • Https://acousticrecords.ru

      https://acousticrecords.ru pnk studio студия звукозаписи в москве.