Reputation: 742
I have the following piece of script:
$Username = Read-Host -Prompt 'Input your user'
$pwd = Read-Host -Promt 'Input your password'
$Server = '\\10.218.NN.NN\Folder'
echo "net use f: $Server /u:domain\$username $pwd"
net use "f: $Server /u:domain\$username $pwd"
I have the echo return the output of my script, as its the following:
net use f: \\10.218.108.49\Soporte /u:domain\user.name password
Running it via script shows the following error:
System error 67 has occurred.
The network name cannot be found.
But running the exact same command with CMD connects the folder properly. How can I be able to map network folders with my script without failing?
Upvotes: 0
Views: 1153
Reputation: 113
Just remove the quotes in the last line of code:
net use f: $Server /u:domain\$username $pwd
Upvotes: 1