The title says it all. If you want to know whether and what domain a computer
is logged onto, the UserDNSDomain environment variable will tell you. The nice
thing is that you can use the environmental variable in automation scripts where
you want to do different things depending on which domain a computer is logged
onto.