Running a process as Administrator in Vista, Windows 2008?
-
Hello all , As windows Vista and windows 2008 have all come with an option of "Run as Administrator", Is there some way to programmatically invoke some executable so as it could be invoked as 'Administrator' ? Regards, Kushagra
-
Hello all , As windows Vista and windows 2008 have all come with an option of "Run as Administrator", Is there some way to programmatically invoke some executable so as it could be invoked as 'Administrator' ? Regards, Kushagra
Hi Kushagra, You should investigate the CreateProcessAsUser Function[^]. You may also be interested in this Microsoft help and support article: CreateProcessAsUser() windowstations and desktops[^] P.S. Have you finally decided to follow my recommendations[^] for delaying the windows shutdown? [Update] I based my answer on prior knowledge of the windows service project you have been working on. For the sake of completeness a process can also be elevated by adding the _T("runas") verb. Redesign for UAC Compatibility (UAC)[^] Best Wishes, -David Delaune
-
Hi Kushagra, You should investigate the CreateProcessAsUser Function[^]. You may also be interested in this Microsoft help and support article: CreateProcessAsUser() windowstations and desktops[^] P.S. Have you finally decided to follow my recommendations[^] for delaying the windows shutdown? [Update] I based my answer on prior knowledge of the windows service project you have been working on. For the sake of completeness a process can also be elevated by adding the _T("runas") verb. Redesign for UAC Compatibility (UAC)[^] Best Wishes, -David Delaune
Randor wrote:
support article: CreateProcessAsUser() windowstations and desktops[^] P.S. Have you finally decided to follow my recommendations[^] for delaying the windows shutdown?
Hey Randor, Its gr8 to hear from u again, CreateProcessAsUser is what I am looking into, but what I need is some way to elevate permissions of my executable as soon as it is invoked. and yes I was successful in delaying shutdown by creating a service and handling SERVICE_CONTROL_SHUTDOWN . Your suggestion helped me a lot :). Thanks for always showing the way. Kushagra
-
Randor wrote:
support article: CreateProcessAsUser() windowstations and desktops[^] P.S. Have you finally decided to follow my recommendations[^] for delaying the windows shutdown?
Hey Randor, Its gr8 to hear from u again, CreateProcessAsUser is what I am looking into, but what I need is some way to elevate permissions of my executable as soon as it is invoked. and yes I was successful in delaying shutdown by creating a service and handling SERVICE_CONTROL_SHUTDOWN . Your suggestion helped me a lot :). Thanks for always showing the way. Kushagra
Hi Kushagra, I should have given a more complete answer. I assumed that you were still working on that windows service. The following MSDN article addresses elevation from a standard windows application. Redesign for UAC Compatibility (UAC)[^] Best Wishes, -David Delaune
-
Hi Kushagra, I should have given a more complete answer. I assumed that you were still working on that windows service. The following MSDN article addresses elevation from a standard windows application. Redesign for UAC Compatibility (UAC)[^] Best Wishes, -David Delaune
Thank you :) I am now looking at it
-
Thank you :) I am now looking at it
Can I include some thing in my code to make the application run as Administrator every time when it starts ? Or could I make any other application which when invoked starts my executable to runas Administrator ???All this I have to do in VISTA and WINDOWS 2008 as UAC always comes into picture .. :( Kushagra