Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to mount a network folder in a script using net use, and I keep getting a bad password error. I'm using the following syntax:

use \\server\share password /User:serviceaccount

Doing it this way returns a bad password error. If I put * as the password, and enter it at the prompt, it works fine.

I've also tried enclosing the password in double quotes "" to no effect. This particular password is randomly generated and consists of 14 characters of upper, lower, digits, and special characters (in this case the only special character is $).

The script is being run on Windows Server 2008 R2, and it's connecting to Server 2003.

Are there any limitations on the kinds of passwords that can be passed to net use via command line arguments?

EDIT: This is being run in PowerShell.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

It turns out whereas the old documentation for net use indicated that you needed to use double quotes, in PowerShell you should use single quotes around the password.

share|improve this answer
    
The main difference between single quotes and double quotes in PowerShell is that double quotes allow for interpolation, while single quotes do not. –  jscott Feb 11 '13 at 20:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.