This is a snippet from a function in the main login script for the domain. Check to see if the key exists and that the key contains the users name, if so Exit. Check to see if the computer name and userID match, if so Exit, otherwise write value to key.

This is quite a bit messy and it doesn't seem to work properly most of the time, wondering if anyone would care to lend their knowledge for a better way of doing this

Code:

Dim $exists
Dim $usercheck
Dim $cname

$exists = ReadValue('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters',"srvcomment")
$usercheck = LCase(@UserID)
$cname = LCase(@WKSTA)

Select

Case $exists = @Fullname
Exit()
Case 1

Case $cname<>$usercheck
Exit()
Case 1

EndSelect