[RESOLVED] [2005] Grant Administrator access to a Process?
Hi All,
Inspired by http://www.vbforums.com/showthread.php?t=420404, I was wondering if there is a way to grant Administrator access to a Process?
I have the following code:
VB Code:
Dim p As New Process
Dim psi As New ProcessStartInfo("defrag.exe")
psi.Arguments = drv
p.StartInfo = psi
p.Start()
p.WaitForExit()
The problem is defrag.exe cannot be run under Limited User.
Therefore as a workaround, I have
VB Code:
btnDefrag.Enabled = My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator)
in Form Load.
It would be great if I could make the Form prompt for Administrator user/pass to start the process. Am I imagining things or is this possible in .NET? :)
Thanks guys!
McoreD
Re: Grant Administrator access to a Process?
Well there is a username and password property of the ProcessStartInfo class in order to specify a username and password to run the process under...
Re: Grant Administrator access to a Process?
OMG! Thanks gigemboy. :) I had seen UserName and Password before but didn't think it will smartly handle User Credentials.
Thanks so much.
McoreD