prathapml Posted October 8, 2004 Share Posted October 8, 2004 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 More sharing options...
jdoe Posted October 8, 2004 Share Posted October 8, 2004 Have you tried RUNAS.EXEIf you don't have this file in system32 folder it should be on the CD (I386 folder). Link to comment Share on other sites More sharing options...
firefoxthebomb Posted October 8, 2004 Share Posted October 8, 2004 RUNAS (Windows 2000/XP)Execute a program under a different user account. syntax RUNAS [/profile] [/env] [/netonly] /user: programkey /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 executeExamples: 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 More sharing options...
prathapml Posted October 8, 2004 Author Share Posted October 8, 2004 Wow!Thanks, that's great.Tried running it from CMD, and yes the command exists. I guess its easy to over-look...Anyways, cool and simple, thanks both of you. Link to comment Share on other sites More sharing options...
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