Well there are multiple ways to accomplish that. Two off the top of my head...

One would be to either create a registry key, or create some kind of file on the client once it has been checked. The script can then check for the existence of this key or file, and skip the odbc check if it has already been done.

Second, you can use one of the file i/o functions to load the log file, and check to see if the username/workstation already exists in the log. This method would depend on how many clients you will be checking as the log file could get big, and reading through it at every login might get slow.