title: When powershell is "runas" different user (different domain as well), get that user's domain, and not the logged in user's (on localhost) domain
body: <p>I know how to get the domain of the user that you are logged into on windows. That's not the problem.
  You can do that with <code>$env:USERDOMAIN</code> (and various other ways...)</p>
  
  <p>My situation:</p>
  
  <ul>
  <li>I'm logged into windows as <code>D1Username</code> under <code>DomainOne</code>.</li>
  <li>I run cmd and do: <code>runas /user:DomainTwo\D2Username /netonly powershell</code></li>
  <li>In this powershell session, I have the permissions of <code>D2Username</code>, obviously.</li>
  <li>When I do $env:USERDOMAIN, I get <code>DomainOne</code>, when (I would think) I should be getting <code>DomainTwo</code>. </li>
  </ul>
  
  <p>What can I do, if anything, to get the domain of the user that is being logged into via "runas"?</p>