Jump to content

How can I do a run-as from command-line?


prathapml

Recommended Posts

How can I do a command-line run-as?

I got this necessity recently... There's this organisation with some employees who aren't able to control their urge to fiddle with their systems. So we have locked-down systems, by disabling access to explorer interface completely. So there's no way to access the start-menu or MyComputer-style windows. No right-clicks allowed either. I've changed over to a different shell - task manager is disallowed.

When I'm logged into a limited-user's account, and suddenly need to do something which is not allowed by his account (or need to do some file-permissions, or need to browse/delete files that he can't) I need to login with an admin account. Now, no matter what account I login to, the task is anyway only possible from a CMD-prompt. But still, I can make my task easier by "Running As" whatever I want to do with administrator powers.

Now since I haven't disabled any of the services required for the Run-As facility, I suppose this should be possible, but how? I'm logged in as user XYZ, and have access to the command prompt. I need to "Run-As" something that needs admin privileges.

For those of you you familiar with unix/linux, a simpler way for me to put it is -

I'm looking for the win32 command-line equivalent of the "su" command.

Thanking all in advance, for the help. :)

Link to comment
Share on other sites


RUNAS (Windows 2000/XP)

Execute a program under a different user account.

syntax

RUNAS [/profile] [/env] [/netonly] /user: program

key

/profile Option to load the user's profile (registry)

/env Use current environment instead of user's.

/netonly Use if the credentials specified are for RAS only.

/user Username in form USER@DOMAIN or DOMAIN\USER

(USER@DOMAIN is not compatible with /netonly)

program The command to execute

Examples:

runas /profile /user:mymachine\administrator CMD

runas /profile /env /user:SCOT_DOMAIN\administrator NOTEPAD

runas /env /user:user@domain.microsoft.com "NOTEPAD \"my file.txt\""

NOTE: Enter user's password only when prompted.

Found on Google

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
  • Recently Browsing   0 members

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