SEARCH

The How-To Geek Forums Have Migrated to Discourse

How-To Geek Forums / Windows 7

(Solved) - RunAs Batch File

(10 posts)
  • Started 1 year ago by gedstar
  • Latest reply from gedstar
  • Topic Viewed 1483 times

gedstar
gedstar
Posts: 521

Hi All,

I'm trying to create a batch file to run dsa.msc which is the Active Directory console

This is the command I'm using runas /user:HQD01\Administrator "C:\Windows\system32\dsa.msc" which when run ask me for the administrator domain password when I enter this it doesn't open the dsa.msc

If I pause the script I can see "Attempting to start C:\Windows\system32\dsa.msc as user "HQD01\Administrator" .....

If I use the Shift Key and do a RunAs as normal it works fine.

Anyone have any idea's

Cheers in Advance

Ged

Posted 1 year ago
Top
 
scorpion99
scorpion99
Posts: 1033

hi,
Try the following :
runas /profile /user:HQD01\Administrator "%windir%\system32\dsa.msc"

Here where is HQD01 is your computer name and Administrator is the username
This must be run on the server which have the active directory installed and not any other PC
check this for more info :
http://www.microsoft.com/resou.....x?mfr=true

Posted 1 year ago
Top
 
gedstar
gedstar
Posts: 521

Hi scorpion99

I have Active Directory installed on my PC and HQD01 is the name of our Domain, when I use shift right click on Active Directory Users and Computers in administration tools and select Run As different user on my PC and enter the Domain Admin credentials it opens fine.
I'll have a read through the link you sent and see if I can figure it out

P.S. tried runas /profile /user:HQD01\Administrator "%windir%\system32\dsa.msc" no joy either

Cheers

Posted 1 year ago
Top
 
scorpion99
scorpion99
Posts: 1033

gedstar , It's weird because I tried on my domain before suggesting it to you
are you getting an error message after running it? Is User Account Control is enabled on your PC , if yes , turn it off and try it again.

Posted 1 year ago
Top
 
gedstar
gedstar
Posts: 521

Hi scorpion99

No I don't get an error when running it, as I said earlier If I pause the script I can see "Attempting to start C:\Windows\system32\dsa.msc as user "HQD01\Administrator"
Yes User Access Control is enable, will try turning if off tomorrow and post back

Cheers

Ged

Posted 1 year ago
Top
 
gedstar
gedstar
Posts: 521

Hi scorpion99

Well tried it with UAC disabled and still no joy, looks like I'll have to go back to doing it the old fashioned way, cheers for the help

Ged

Posted 1 year ago
Top
 
scorpion99
scorpion99
Posts: 1033

gedstar , did u make sure that no firewall is blocking the script? , as u said , it gives that it is starting so ur code is fine.

Posted 1 year ago
Top
 
gedstar
gedstar
Posts: 521

Hi scorpion99

I was able to run similar scripts on Windows XP 32bit PC's on the same network without any problems so don't think it's a network firewall issue, just after thinking my PC in work is Windows 7 64bit OS maybe that's the issue the 64bit bit, probably should have mentioned this at the start.
What I'll do is try it on a Win XP 32bit machine tomorrow and see if that works.

Cheers

Ged

Posted 1 year ago
Top
 
scorpion99
scorpion99
Posts: 1033

gedstar , when i tried the script , it didn't work on my Windows 7 x64 , but when I tried on my Domain Controller (2008 R2 server) it works perfectly.
(dsa.msc is not available on windows 7 unless if you install the remote server administration tools)
http://www.microsoft.com/en-us.....px?id=7887

Posted 1 year ago
Top
 
gedstar
gedstar
Posts: 521

Hi scorpion99

Have already got the remote server administration tools installed on my PC, not to worry, I'll just revert to the Shift, Right Click way of doing it. Cheers for the help

Ged

Posted 1 year ago
Top
 



Topic Closed

This topic has been closed to new replies.

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!