Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I'm as user in my pc, then I created a code that inetracts with printer, to do this I added manifest file and changed the requestedExecutionLevel to
XML
<requestedexecutionlevel level="requireAdministrator" uiaccess="false" />

when I run it, it requires admin login and password. Once I know admin password then I'm going to add use it so that application must run as administrator without requiring admin password again, it should work directly. Is it possible to add admin's login and password into manifest file or source code?

What I have tried:

I added manifest file and changed the requestedExecutionLevel to
XML
<requestedexecutionlevel level="requireAdministrator" uiaccess="false" />

when I run it, it requires admin login and password. Once I know admin password then I'm going to add use it so that application must run as administrator without requiring admin password again, it should work directly. Is it possible to add admin's login and password into manifest file or source code?
Posted
Updated 29-Feb-16 5:20am
v2
Comments
Richard MacCutchan 29-Feb-16 8:12am    
No, you will need to provide the administrator password each time the program runs. The whole point of UAC is to protect the system from hackers.
Philippe Mori 29-Feb-16 12:42pm    
Never bypass Windows security under no circumptance. We won't help you write virus and spyware. Most programs do not need elevated access beyond initial installation when the user expect system wide changes. Before hacking system, you should read articles on improved security since Windows Vista. Most program have been updated long ago to properly works with improved system security. Don't be lazy and rewrite your program if necessary.

1 solution

You can't do that. First, when the administrator password changes, your code is going to break. Second, are you REALLY going to put an admin level password into a file in PLAIN TEXT? What kind of security is that?!?!?!

You either put the manifest file in there with the requestedexecutionlevel and put up with the credential dialog or you don't run your application.

The security is there for a reason. It's to prevent you from blindly using your admin credentials without knowing OR, since code always runs as the user that launched it, having other code use your admin security token without you knowing it.
 
Share this answer
 
Comments
BillWoodruff 29-Feb-16 13:57pm    
+5 Amen !
Little@Knight 1-Mar-16 6:40am    
Oh no, some of you misunderstood me. I was doing a project which monitors shared printer among users. I'm one these users and my co-worker has admin rights. He couldn't stop printer using our code he could just stop printer from Printer Management properties. Unfortunately I don't have anyway, when I run application it asking admin and my co-worker sets password every time. I just wanted to avoid that situation:( We are allowed to connect to our server via LDAP. anyway I got the solution by researching sorry and thank you all!

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