Sign in to follow this  
Followers 0
matthewst

Runasset Won't Open A Command Prompt As Admin

6 posts in this topic

I am trying to open a command prompt as the local admininstrator.

When I run the following script (script or exe) all I get is my regular command prompt.

RunAsSet("Admin", @Computername, "password")
Run("cmd.exe")

If you open a command prompt and type "runas /user:admin cmd" you'll be prompted for your admin password, then a second box will open that is titled "cmd (running as compname\admin)".

Everything else I put in the script works notepad.exe, regedit.exe just not cmd.exe.

Share this post


Link to post
Share on other sites



Not for me. I'm trying to avoid a sendkeys fiasco.

Share this post


Link to post
Share on other sites

Works for me too.

If I type in whoami at the command prompt (command should be available at least in XP Pro sp2), it reports the correct admin user I supplied for RunAsSet even though the title bar looks the same.


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

it just opens a dos box (my profile, not the admin)

i'm using xp sp2

no errors of any kind. It just sits there like i clicked "start", "run", typed "cmd" and hit enter

Share this post


Link to post
Share on other sites

This should make you happy if you want the title changed:

$username = "Administrator"
RunAsSet($username, "", "password")
Run('cmd /c start "cmd (running as ' & $username & ')" cmd.exe')

Double check by running whoami


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

:think: You guys hit the nail on the head this time!

I guess I was expecting autoit to be a bit clunky (like some other languages)

Thanks everyone!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0