3

I have two executables. My first is running under administrative privileges. I want to start another process with current logged in user. I don't know password of the current logged in user. How do I do that?

J. Steen
  • 15,470
  • 15
  • 56
  • 63
Rupali
  • 105
  • 2
  • 13
  • 1
    Can you give a bit more information as to what you are trying to achieve? What have you tried so far? – Gaz Winter Dec 19 '12 at 11:47
  • 1
    Are you saying that you want to start the process unelevated, or as an entirely different but logged on user? – wj32 Dec 19 '12 at 11:47
  • if you want to retrieve the current user name or to limit privileges – S3ddi9 Dec 19 '12 at 11:48
  • How about removing Administrative privileges? – Gregor Primar Dec 19 '12 at 11:48
  • My exe running in administrative privilege will call the exe. for that i am using process as process.start in that i used verb as "runas". I got current logged in user id but the problem is i dont have password.. – Rupali Dec 19 '12 at 11:50
  • Possible duplicate: http://stackoverflow.com/questions/1173630/how-do-you-de-elevate-privileges-for-a-child-process If you only want to "de-elevate" privileges. And also this http://stackoverflow.com/questions/196949/how-to-run-not-elevated-in-vista-net – Alvin Wong Dec 19 '12 at 11:53

2 Answers2

0

You can do this by impersonating the logged on user. Here is a link which specifies 3 ways of doing this (not much of a detail though) Run an application under current logon user's privileges

stamhaney
  • 1,246
  • 9
  • 18
  • I already have logged on username using 'explorer.exe' but to run process in need password of currently logged in user.. – Rupali Dec 19 '12 at 11:56
  • There is no way to get the password of the logged in user other than ask the user. I though this was a valid question... – stamhaney Dec 19 '12 at 12:00
  • Yes but cant i run a process without password for verb='runas' – Rupali Dec 19 '12 at 12:05
0

First you need to know who is logged in and in this user has an active desktop, then, get process handle started by this user and grab credentials from this process. You can then sart process with those credentials

Kubi
  • 2,139
  • 6
  • 35
  • 62
  • yes i got logged in user with explorer.exe user whose sessionid = 1. now how to get user credentials to start the process?? – Rupali Dec 20 '12 at 04:30