Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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


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.