Your best bet may be to store the Computer's group membership in an array and reference the array instead of calling query based UDF's multiple times. This way you'll have a fresh (as of logon) collection of the computer's groups, but won't have to query AD everytime you want to check membership.