1

I'm in a somewhat unique situation.

I am trying to create a windows user, using the command line or a batch file. I know how to do that in the basic case:

net user username password /add

The problem is that i am doing this through an endpoint management system, which will log (publicly) whatever command line i am running, so if the password is written in the command line it would be visible to all.

I do have a temporary file that contains a file, so if i could get the "net user" command to read the password from a file, i could get around this logging issue.

The best I've come up with is:

type password.txt | net user username * /add

Which acts like it works, except that the password is always blank.

Thanks

2 Answers 2

3

Someone pointed me to Server Fault, which provided me with the correct answer:

set /p pwd= <filename.txt
net user username %pwd% /add 

(Courtesy of server fault user "nedm")

0

You could use this PowerShell script to create the accounts from a CSV file containing the usernames and passwords.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .