Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Batch file to run MMC as a different domain user?

27 Oct 2010   #1

Windows 7 Home Premium x64
Batch file to run MMC as a different domain user?

I'm stumped.
I have a batch file that I used on XP to run an MMC that I created for common management tasks. In the MMC I have the ability to run regedit as a root forest domain privileged user (for remote system registry editing), password resets (using AD) remote computer management, and several web links for common sites the team uses. I did this so it was all in one place and it worked awesome in Win XP. When I run the batch file it reports that the directory could not be found.

Here's the command in the batch file:
C:\WINDOWS\system32\runas.exe /savecred /profile /env /user:root forest domain account "mmc Admin_Tools.msc"

Obviously the account being used for the privileged access is put after the user switch.

Here is the error I get:

C:\Users\username\Desktop>C:\WINDOWS\system32\runas.exe /savecred /profile /env
/user:elevated username "mmc Admin_Tools.msc"
Attempting to start mmc Admin_Tools.msc as user "root forest domain account" ...
RUNAS ERROR: Unable to run - mmc Admin_Tools.msc
267: The directory name is invalid.

I have verified that runas is in the same place as in XP, as well as MMC. I have run the batch file with elevate access as well as run the command prompt with elevated access (in fact that was copied from an elevated command prompt). The account I'm running it on has admin rights on the box, though UAC is set, I own both the account this was run from and the "root forest" privileged account, this account is NOT a domain admin.

This is all being done on Win 7 Pro in a large enterprise domain environment. Again, this batch file worked and still works on Win XP in the same environment.


I should add that the MMC console runs fine if I don't use the batch file.

My System SpecsSystem Spec
30 Oct 2010   #2

Windows 7 Home Premium x64


I know we have some awesome how-to people here, maybe it should be in a different forum?
My System SpecsSystem Spec
30 Oct 2010   #3

Windows 7 Ultimate x64 SP1 clean install

I tried this and it works:
runas /user:Davide "mmc services.msc"
Can you try the same command as mine and see if it works?
My System SpecsSystem Spec

31 Oct 2010   #4

Windows 7 Home Premium x64

I'll try it tomorrow.

I'm also considering using Powershell for this rather than a batch file but I need to learn a little about it first.
My System SpecsSystem Spec
01 Nov 2010   #5

Windows 7 Home Premium x64

Did not work. It tells me it requires elevation, even running from an elevated command prompt.
My System SpecsSystem Spec

 Batch file to run MMC as a different domain user?

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar help and support threads
Thread Forum
How to run a batch file at logoff & some batch scripting help please
Hiya, I'd just like to run a simple batch file at logoff to backup some settings. I plan to use Robocopy, which is what i use to more thorough backups. Two questions: 1. How make it run by clicking Start > Shutdown? (i realise i could make a shutdown batch file and run it instead, but i'd...
Backup and Restore
Batch file to automatically log a user off after a time of inactivity
Those of you who have read my posts over the past couple of weeks know what am doing on a computer belonging to an Assisted Living facility. I have the user accounts set up plus I have removed the "Switch User and Sleep menu items from the context menu of "START.......SHUTDOWN. I have reminded the...
General Discussion
Batch File to set user's windows login pic
Alright, I'm doing a little bit of research to help automate some customizations that I'm doing for my client's computers. I've got most of what I need done. But what I am trying to do now is set the user's current profile picture to one that is already there. The picture itself isn't going to...
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion
Strange Defult Login User Prompt - Local Admin, Not Domain User
So a new box recently built, when booted, defaults to the local administrator account. This is a Windows 7 machine for a Linux guru that doesn't want to be bothered pressing more buttons than is necessary, if you get my drift. So my question is, after pressing do I...
General Discussion
How to create a batch file that will move files based on the file type
How to create a batch file that will move files based on the file type? My Requirement : I need a batch file to copy all .doc files in all my HardDisk to a removable disk say (Z: drive) . Can anyone make it possible using a batch file?Please...Its urgent...
General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 14:47.

Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App