|
-
Aug 5th, 2006, 10:23 PM
#1
Thread Starter
Addicted Member
[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
Last edited by ~*McoreD*~; Aug 6th, 2006 at 01:13 AM.
-
Aug 6th, 2006, 12:23 AM
#2
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...
-
Aug 6th, 2006, 01:12 AM
#3
Thread Starter
Addicted Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|