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