matthewst Posted April 17, 2006 Posted April 17, 2006 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.
matthewst Posted April 17, 2006 Author Posted April 17, 2006 Not for me. I'm trying to avoid a sendkeys fiasco.
CyberSlug Posted April 17, 2006 Posted April 17, 2006 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!
matthewst Posted April 17, 2006 Author Posted April 17, 2006 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
CyberSlug Posted April 17, 2006 Posted April 17, 2006 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!
matthewst Posted April 18, 2006 Author Posted April 18, 2006 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!!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now