-1

I want to run my c# console application as an admin without UAC on non-admin account. Problem is, when i disable UAC with eiter Task scheluder or Microsoft Compatibility kit, my app runs with non-admin rights. Only time i Can rup an app with admin privilegs is when i right click - run as admin and i enter password. But i dont want to do that. I want to run app on non-admin account with admin privileges.I dont know where to problem is. When i try to run application with "runas" and i use Admin account with correct password, it pops me : access is denied. I dont know if problem is in my application or somewhere else.

Thanks

  • How are you disabling UAC exactly? What version of Windows are you using? Windows 7 UAC can easily be disabled, its more difficult to do, on Windows 10 but certainly possible. However, even when disabled, Programs will continue to run at the users lowest permission level unless you escalate the process (that behavior cannot be changed) – Ramhound May 23 '19 at 11:09
  • I am disabling UAC with creating a task in task scheduler, where i create a task which will start a program with highest privileges. But it still doesnt work. I tried disabling UAC by microsoft combatibility kit by creating applicaton fix with privileges "runAsInvoker". I am using Windows 10 64 bit. I tried both methods with admin rights. – Christián Szeman May 23 '19 at 11:12
  • So your not [disabling UAC systemwide](https://superuser.com/questions/1013702/completely-disable-uac-in-windows-10)? – Ramhound May 23 '19 at 11:25
  • No i am disabling UAC only for specific app – Christián Szeman May 23 '19 at 11:27
  • **How** are you doing that exactly? – Ramhound May 23 '19 at 11:28
  • https://www.tenforums.com/tutorials/57690-create-elevated-shortcut-without-uac-prompt-windows-10-a.html , i did it exactly like this. When i click on that shortcut it still runs with non admin privileges. I tried also this https://mynuuo.zendesk.com/hc/en-us/articles/360000764413-How-to-disable-UAC-for-a-specific-program . Also no luck there. – Christián Szeman May 23 '19 at 11:29
  • Please [edit] your question and include all relevant information. Show exactly what you've already tried. – slhck May 23 '19 at 12:12

2 Answers2

0

Add application manifest file and enter following code

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />  
Zeeshan
  • 115
  • 3
0

The process of using Task Scheduler to “run with highest privileges” is not how you bypass UAC.

If you have an application that needs to run and interact with the logged on user, then that app will run with the user’s permissions. You can use task scheduler to run a task as a different user but then it won’t interact with the logged on user. Running a task as the logged in user limits the application to the highest permission the user has.

The other procedure of using the application compatibility toolkit also does not solve the issue. What this does is take a misbehaving application that is “requiring” an admin password but doesn’t actually “need” admin permissions and making it so it will run without any UAC / admin prompts.

If your application “requires” admin permissions then the user HAS to run the application as another user with admin permissions using the username and password of that user or it will fail.

Disabling UAC on the computer will not only severely reduce the security of the system it will make it so when you run any app with a limited user account you won’t even be prompted to elevate with the credentials of an admin user and your application, if it requires admin access, will fail.

The problem here is your app requires admin permissions. That is what needs to be fixed. What is it doing that requires admin permissions? Why? Redesign it so it doesn’t. Otherwise, there is no “secure” way of allowing a non-admin user to run an application with admin permissions. It is no longer acceptable practice, and has not been for years now, to design applications that require that level of permission for standard users to use.

If you absolutely have to have a standard user run an application as admin you can use the “runas” command or some third party administrator tools that allow a user to request access and an administrator to remotely respond to allow the application. Again, the problem is the app, not the OS. Trying to work around this would not be acceptable in most use cases that required users to use limited accounts in the first place.

Appleoddity
  • 11,565
  • 2
  • 24
  • 40
  • My app is monitoring app which needs to have access rights to add and modify firewall rules and registry Keys. Thats why i need to have an app running with admin privileges on Non admin account. – Christián Szeman May 23 '19 at 13:58
  • @ChristiánSzeman great. But you don’t specify WHY that app needs to run as a limited user as well? You can’t have both. An app like you describe is an app that should be run as a service or in the background as SYSTEM or another elevated user and task scheduler CAN do that. But if you expect the app to be started by a limited user and interact with that user it’s not going to happen. Limited users can’t change firewall rules. That’s just the way it is. – Appleoddity May 23 '19 at 14:01
  • Okay so you are recommending that i transform my .exe application into service? – Christián Szeman May 23 '19 at 14:22