If my memory servers me well, you could also just check whats returned from @DOMAIN and @LDOMAIN

@DOMAIN is the domain where you computer account resides.
@LDOMAIN is the domain you logged on to.