Yes.

Search this board for lots of examples - look in the FAQ forum for specific Citrix / Terminal Server help.

If you want to know whether the user is in an ICA session, the easiest test is to check the %CLIENTNAME% environment variable.