This is a mirror of official site: http://jasper-net.blogspot.com/

Impersonate as another user to run a program

| Sunday, March 7, 2010
This is an extension to the "runas" command in windows, so the current user can impersonate as another user to run a program. The motivation is to let a standard user run a program as Administrator without inputting the password every time, as discussed here:

   * Why doesn't the RunAs program accept a password on the command line?

     http://blogs.msdn.com/oldnewthing/archive/2004/11/29/271551.aspx

Background

The link above gives an in-depth insight for the "runas" command in Windows. However, although it makes sense that the "runas" command doesn't take password as parameter, it does give a lot of trouble to personal users, and to me.

Let's say, we have Windows 7 installed on a home computer, and we don't want other "non-skilled" family members (your wife, children, grandma, etc.) to change critical settings or install software. We want them to use only the software that we allow them to run.

OK, it's easy, we create a "Standard User" account and give to them, and install software under the Administrator account, which is owned and only owned by us. So your wife/children/grandma can only run the programs you install.

So, things fixed?

Now, you install a program which needs administrator privilege, which means unless you turn off user account control, the "standard user" will be prompted to input Administrator password each time they run the program. And, your wife will be yelling: "hey, what is the ****ing password?" "Why do you make such complicated settings?"

Unfortunately, there are quite a number of applications that work this way and we simply cannot let a "standard user" run the program without inputting the admin password.

This program was written to solve the problem.

Read more: Codeproject

Posted via email from jasper22's posterous

0 comments: