Link to home
Start Free TrialLog in
Avatar of PROACTIVETG
PROACTIVETG

asked on

How to run code as "administrator" user with UAC enabled.

We have a terminal server running Windows 2013 R2. We need to run an application that we wrote to periodically register a .dll file as the domain administrator. The code works on a computer without UAC enabled.

Once UAC is enabled the code will no longer work. Please see the function attached.   User generated image
Avatar of John
John
Flag of Canada image

A person needs admin authority to register a DLL. That is normal and UAC should not be disabled (because of other security concerns).

How often to you need to register this DLL?  Register it once and then done?
Avatar of PROACTIVETG
PROACTIVETG

ASKER

In the code we have the credentials of the administrator (encrypted).

We need to register the .dll files only after software upgrades of a specific accounting application. Seems the application upgrade works but misses the last part of the upgrade (registering the .dlls). Since there are so many upgrades we want users to upgrade the application but they do not have rights to register .dlls.
What we do for our QuickBooks clients is schedule the upgrades so we can go to all the machines in one client and upgrade QB. We do that as administrator. This works fine.

I am not sure what to suggest short of reducing the number of upgrades or scheduling them so they can be managed.

Turning off UAC is indeed dangerous.
Understood. What we are really looking for is someone to help us run the C# code. See attached script.
No one have an answer?
Any code that registers DLL's or does like work, needs to run as Administrator and have UAC authorized at the time of the install. I have not seen installs as you wish run as an ordinary user.

So I think you have to run scheduled maintenance at the computers to do what you want.
So what I'm asking is not possible?
ASKER CERTIFIED SOLUTION
Avatar of John
John
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial