Batch files and MSC

M

mrturner

Is there anyone who might be able to tell me how I can incorporate and
password into a batch file that runs an MSC. Specifically, the Disk
Management MSC. As you can plainly see, I don;t write a lot of batch
files. The text is below.

runas /user:Administrator "cmd /c c:\windows\system32\diskmgmt.msc"

The aim of this is to allow me to change a drive letter on my end users
computers without having to type in the administrator password 130
times.

Any assistance would be great.

Matt
 
M

Miha Pihler [MVP]

Hi,

You can't do this with runas command for security reasons.

If client computers have same password for their local administrators you
could start MMC and disk management tools on your PC and then use "Connect
to" option to switch between PCs remotely without the need to enter
password...

You could also use command line tools like diskpart for managing volumes,
partitions, . and use it in combination with pstools (free tools) from
sysinternals http://www.sysinternals.com/utilities/pstools.html where you
can actually also script in the password (but be aware of security
implications). You can also use pstools to start MMC as described in your
post without using runas. Again be aware of security implications.
 
P

Paul Rasmussen

Is there anyone who might be able to tell me how I can incorporate and
password into a batch file that runs an MSC. Specifically, the Disk
Management MSC. As you can plainly see, I don;t write a lot of batch
files. The text is below.

runas /user:Administrator "cmd /c c:\windows\system32\diskmgmt.msc"

The aim of this is to allow me to change a drive letter on my end users
computers without having to type in the administrator password 130
times.

Any assistance would be great.

Matt


Hello

take a look on http://www.robotronic.de/runasspcEn.html
download the tool runasspc.
In the zipfile you find an example in the batchfile start.bat to run the msc
console without enter a password.
 
M

mrturner

Thanks for the input. I tried the first suggestion but due to what I
imagine is a restriction in place by our senior administrator I
received an "NO RPC SERVER AVAILABLE" error.
I like the sound of your second idea though. The security implications
will be minimal. This is a once off run to solve an issue with the use
of USB keys wanting to default to a pre defined network drive.

Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top