Jump to content

Runasset Won't Open A Command Prompt As Admin


Recommended Posts

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.

Link to comment
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!
Link to comment
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!
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...