Retreiving environment variable from remote system

I am trying to write a short block of code that takes a partial filename as input from the command line, then searches multiple remote servers for any file that matches the pattern. If the pattern is found, I would like to return the value of an environment variable from the *remote* server.

I've tried a few different ways, but I keep getting the value of the environment variable from the *local* server. Any ideas?

Thanks!