Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hey,

i want to create a windows application to do some administrator stuff without login prompt. This application should be execute by normal user without privileges. For example i want to send this application to a external client in another country via mail. After execution the application updates license files for avira antivir(only possible as administrator under windows 7). I dont want to send them the administrator password and i can't connect remote.

Instead I want to save the username and password for authentification in this windows application (console application or something else). I search for some functionality on google and so on, but i can't find anything.

Any idea?

best regards
chris
Posted
Comments
m0rTu 13-Apr-12 4:28am    
You can always use microsoft implemented way...
Process.Start Method (String, String, SecureString, String)
Hope this helps

Look into the following Windows system calls:

LogonUser
ImpersonateLoggedOnUser

The first retrieves an access token for a user account on the local machine. The second lets your current thread impersonate that user.

Beware: If you want to store the administrator's account name and password in your application, then have them encrypted in some way. Otherwise, it's just to easy for any user of your program to look at the exe file and guess the account name and password.
 
Share this answer
 
You may want to write a windows service that runs with elevated privileges and let the service handle stuff that requires that permission. Use the win forms app to 'configure' the service.
 
Share this answer
 
Thank you very much for the answers! I found the LoginUser and additional functions, too. I will try it now. The security is on my list and I had some ideas to solve this problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900