CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Join Date
    Dec 2008
    Posts
    18

    How would i run my application as a admin insted of rightlicking and choose rus as?

    I wrote a application that will unlock users when they get locked out. I need my application to authenticate and run as a admin user so it can unlock the locked out users when a normal user runs it. I need to have the the admin credentials stored inside my application so it authenticates first then unlocks the locked out users if you need to see my code i will be happy to post.


    I dont want to add a text box for user or pass and give the person who will be using this a admin account.... not cool
    and this admin account that will be stored inside my app will be monitored closely.


    Thank you for your time

    Summey

  2. #2
    Join Date
    Jun 2008
    Posts
    2,477

    Re: How would i run my application as a admin insted of rightlicking and choose rus a

    Quote Originally Posted by summey View Post
    I wrote a application that will unlock users when they get locked out. I need my application to authenticate and run as a admin user so it can unlock the locked out users when a normal user runs it. I need to have the the admin credentials stored inside my application so it authenticates first then unlocks the locked out users if you need to see my code i will be happy to post.


    I dont want to add a text box for user or pass and give the person who will be using this a admin account.... not cool
    and this admin account that will be stored inside my app will be monitored closely.


    Thank you for your time

    Summey
    So, if the user doesn't have to enter a password to enable the account, I fail to see the security in that approach. Anyone could execute the program without trouble, so what would be the point?

  3. #3
    Join Date
    Dec 2008
    Posts
    18

    Re: How would i run my application as a admin insted of rightlicking and choose rus a

    the plant lead will have the application so if the user out on the floor locks out the terminal he can just click search and find the account and hit unlock done but because the lead is a normal user it wont work because my app requires you to run as admin ... I want to add admin creds inside my code they wont see it it wil be compiled and i cant just give them an admin account they will log in to there machine using that etc.. so i just want my program to start then when you click unlock it authenticates with Active directory with the account stored in my app then unlocks the locked out users

  4. #4
    Join Date
    Jun 2008
    Posts
    2,477

    Re: How would i run my application as a admin insted of rightlicking and choose rus a

    Hmmm...not sure how to address your problem, but my opinion is that the plant lead should still have to type in their password. That is the standard way of doing this stuff and for good reason; you cannot ensure that the program will never fall into the hands of someone else.

  5. #5
    Join Date
    Dec 2008
    Posts
    18

    Re: How would i run my application as a admin insted of rightlicking and choose rus a

    yeah but its only able to unlock a uses account they cant do anything else i mean of cores if they disassemble my app then yeah they could see the user and pass but those creds like i said before will be highly monitored. and and i can publish this to except updates then just change the password once a month or whatever and it will check for updates and change the password in the app.

  6. #6
    Join Date
    Jun 2008
    Posts
    2,477

    Re: How would i run my application as a admin insted of rightlicking and choose rus a

    Quote Originally Posted by summey View Post
    yeah but its only able to unlock a uses account they cant do anything else i mean of cores if they disassemble my app then yeah they could see the user and pass but those creds like i said before will be highly monitored. and and i can publish this to except updates then just change the password once a month or whatever and it will check for updates and change the password in the app.
    what if they change their password? How will you know if you are storing credentials internally? I just don't think that it is a good approach.

  7. #7
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How would i run my application as a admin insted of rightlicking and choose rus a

    there's a VBS file that you can download called ELEVATE that lets you script values into batch/powershell scripts
    Last edited by dglienna; May 14th, 2009 at 07:06 PM.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  8. #8
    Join Date
    Dec 2008
    Posts
    18

    Re: How would i run my application as a admin insted of rightlicking and choose rus a

    no they wont have a clue what creds are in the application i just want to authenticated the application to it runs as a admin instead of having to right lick and run it as a admin then entering creds .... i will be changing the password for that account with in my app using updates for the program...

  9. #9
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How would i run my application as a admin insted of rightlicking and choose rus a

    sorry. edited the post. looked up info.. MSDN Magazine Copyright. Should be free
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  10. #10
    Join Date
    Jun 2008
    Posts
    2,477

    Re: How would i run my application as a admin insted of rightlicking and choose rus a

    Quote Originally Posted by summey View Post
    no they wont have a clue what creds are in the application i just want to authenticated the application to it runs as a admin instead of having to right lick and run it as a admin then entering creds .... i will be changing the password for that account with in my app using updates for the program...
    OK. The problem is that, if the user is not an admin, the program cannot run as an admin by default. That is the security model. Otherwise, what would be the point of running as a limited user if you could just run programs that did things with administrative credentials? It just doesn't make sense...

  11. #11
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How would i run my application as a admin insted of rightlicking and choose rus a

    Found it.
    http://technet.microsoft.com/en-us/m...t.aspx?pr=blog

    You should look into Powershell 2.0 CTP

    That would allow you to create a batch like environment that you can INVOKE on a target machine
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  12. #12
    Join Date
    Dec 2008
    Posts
    18

    Re: How would i run my application as a admin insted of rightlicking and choose rus a

    thank you for the link ill check that out i use powershell.

  13. #13
    Join Date
    Feb 2009
    Posts
    56

    Re: How would i run my application as a admin insted of rightlicking and choose rus a

    1. Hello, I have a similar case that I need to run my desktop application as admin or at least I need my system to display a message box to grant the permission for the run of the application
    2. Do you know why even when I chose to run my application as admin, the application still stops running due to violation of access permit "You dont have permission to access C:\\somefolder" for example.


    THANKSSS
    -----

  14. #14
    Join Date
    Dec 2008
    Posts
    18

    Re: How would i run my application as admin insted of rightlicking and choose run as

    I'm trying to authenticate against active directory. Are you on a domain ?

  15. #15
    Join Date
    Dec 2008
    Posts
    18

    Re: How would i run my application as a admin insted of rightlicking and choose rus a

    this is what im talking about

    http://msdn.microsoft.com/en-us/maga...135979.aspx#S9

    Figure 12 Authenticating a User in AD LDS


    Code:
    // establish context with AD LDS
    PrincipalContext ldsContext = 
        new PrincipalContext(
            ContextType.ApplicationDirectory, 
            "sea-dc-02.fabrikam.com:50000", 
            "ou=ADAM Users,O=Microsoft,C=US");
    
    // determine whether a user can validate to the directory
    Console.WriteLine(
        ldsContext.ValidateCredentials(
            "user1@adam", 
            "Password1", 
            ContextOptions.SimpleBind + 
            ContextOptions.SecureSocketLayer));

Page 1 of 2 12 LastLast

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

Featured