Results 1 to 3 of 3

Thread: [RESOLVED] [2005] Grant Administrator access to a Process?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Location
    Australia
    Posts
    252

    Resolved [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:
    1. Dim p As New Process
    2.             Dim psi As New ProcessStartInfo("defrag.exe")
    3.             psi.Arguments = drv
    4.             p.StartInfo = psi
    5.             p.Start()
    6.             p.WaitForExit()

    The problem is defrag.exe cannot be run under Limited User.

    Therefore as a workaround, I have

    VB Code:
    1. 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.

  2. #2
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    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...

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Location
    Australia
    Posts
    252

    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
  •  



Click Here to Expand Forum to Full Width