Here is the other method, it creates a registry value when it is logged, so that it only logs if the value doesnt exist.

 Code:
$odbcName = "tess_live_readonly"
$logfile = "C:\ODBC_LOG.txt"

If ReadValue("HKCU\Software\ODBC\ODBC.INI\" + $odbcName,"Logged")<>1
   If KeyExist("HKCU\Software\ODBC\ODBC.INI\" + $odbcName) OR KeyExist("HKLM\Software\ODBC\ODBC.INI\" + $odbcName)
      $nul = RedirectOutput($logfile)
      @Date+" - "+@Time+" - "+$odbcname+" Found on "+@WkSta+" under user "+@UserID ?
      $nul = RedirectOutput("")
      $nul = WriteValue("HKCU\Software\ODBC\ODBC.INI\" + $odbcName,"Logged",1,"REG_SZ")
   Endif
Endif