Originally Posted By: Mart
Glenn's example might be a better solution.


He means me (Glenn) not you (Glenn). ;\)

I've had mixed results with the logoff() function. You might want to look into external solutions. I seem to recall that running explorer.exe?? with certain args would reliably log the user off.

You should probably experiment with different techniques for determining what's allowed and what's not, as I illustrated. My example used hard-coded values, but if I were doing this for real, I'd use an INI file and ReadProfileString() functions to load the parameters, so they could easily be changed. You could then do stuff like "if user is in group XXX, load time range XXX, replacing the default time range values with the extended/reduced time range allocated to this group's members"

If you use the TimeDiff() UDF, all you need to store is the end time, and the number of minutes before the end time that are permitted. You could reverse the logic and check the start time and number of minutes permitted..
 Code:
$Start = '13:00' ; start of prohibited time period
$Limit = 120     ; # of Minutes prohibited from start time
; the above values should be read from a config file using ReadProfileString() - EG
; $Start = ReadProfileString('\\domain\netlogon\restrict.ini', 'DEFAULT', 'RestrictStartTime')
; $Limit = ReadProfileString('\\domain\netlogon\restrict.ini', 'DEFAULT', 'RestrictDuration')
$TVal = TimeDiff(@DATE + ' ' + $Start, 'now', 'M')
If $TVal >= 0 And $TVal <= $Limit
 ; log off!
EndIf


Glenn
_________________________
Actually I am a Rocket Scientist! \:D