Net use returns “System error 67 has occurred” when specify username/password
<p>I tried first to connect the remote samba shared folder (Linux) using explorer on a server(Windows server 2012r2)  and entered remote username and password. It works and I can see the remote files.</p>

<p>Then I tried to write a script in powershell.</p>

<pre><code>$dest = '\\remote\shared'
$username = '.\username'
$password = 'password'
net use "$dest" $password /USER:$username
</code></pre>

<p>However it always gives the error of </p>

<pre><code>System error 67 has occurred.

The network name cannot be found.
</code></pre>

<p>But <code>net use $dest</code> doesn't give any error. <code>net use $dest /delete</code> doesn't return any error either.</p>