title: Mapping drive on a remote machine in powershell
body: <p>I am working on a remote machine from my desktop and I have the following script :</p>
  
  <blockquote>
    <p>Invoke-Command -computername $name -authentification default
    -credential $creds1 
    -scriptblock {net use \share $password2 /user:otherdomain\otheruser}</p>
  </blockquote>
  
  <p>Then I get A specified logon session does not exist. It may have already been terminated. This thing is frustrating because if I run <code>net use \\share $password2 /user:otherdomain\otheruser</code> directly on the remote machine it works perfectly. Is there a workaround or did I miss something ?</p>