could you please be a little more clearer? What am I suppose to do with $RC? This script is not working and the permissions on that folder are correct. I even tried this:

$logfile = Open(1, "\\servername\userlogs$\@USERID.log", 1)
$logfile = WRITELINE("LOGOFF ;"+@DATE+";"+@TIME+";"+@USERID+";"+@WKSTA+@CRLF)

According to Kixtart, the mode should be a 1 instead of a 5.
1 If the file does not exist, Open( ) will create a new file.