cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sryan1977
Level 4

Disable UAC

Jump to solution
For my Suite install I had a prereq that checked the EnableLUA registry key to see if the UAC was turned on or not. If it wasn't, it would disable it and reboot the computer. This worked in Vista and Windows 7. It seemed to work in Windows 8 as well but since 8.1 came out we've been having issues where our install gets stuck in a loop. Before it would change they key, reboot, then continue with the install. However, on some Windows 8.1 systems it fails to change the key, reboots anyway, starts the install up again but sees the key hasn't changed so it tries to change it again, fails then reboots, and so on until someone kills the installer through the Task Manager.

Is there a better way to disable the UAC? Or can this not be done any more with Win 8.1?
Labels (1)
0 Kudos
(1) Solution
sryan1977
Level 4

Changed approach by editing registry using bat file (see code below). I use the bat in a prereq. Works great now.

 

@echo off

REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /t REG_DWORD /d 0 /f

REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /t REG_DWORD /d 0 /f

shutdown /r /t 0

 

View solution in original post

0 Kudos
(5) Replies
MichaelU
Level 12 Flexeran
Level 12 Flexeran
This sounds like a question for Microsoft. As an aside, I would strongly advise against changing the UAC setting, or most system settings, from an installation.
0 Kudos
sryan1977
Level 4
The problem is that we install our program in our folder (under program files) while we also install SQL Server Express. The first time our software runs it takes some database files from our folder and moves it to the DATA folder that SQL Server installed. If the UAC is on then the files can't be moved automatically. A user would have to navigate to the DATA folder, see the UAC message, click Continue to get access and then our software would work. But why have all that hassle? Seemed easier to just disable the UAC while it installed (and during the first run). We originally requested this of the user but many neglected to do so and ended up with the same error.

Of course windows 8.1 has made it more difficult to disable the uac easily. Do I think this is the best way? Not really, but it's still easier than dealing with the calls from customers who didn't follow instructions and now the files can't move.

If there's another way to handle this, I'm all ears.
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran
There may also be ways to change your architecture so that this privileged copy isn't required - can you make a non-privileged call that properly imports your database, or otherwise accomplishes the same thing as your copy?

Even if you can't remove that requirement, you can write a small application to do that copy, and invoke it from your main application with ShellExecute. Either set the manifest on that to require privileges, or use the verb RunAs to elevate the helper. Preferably warn your user that you need their permission to do some first-time initialization before launching the helper. Optionally consider doing all this as part of the installation itself.

You are strongly encouraged to avoid making system-level changes to address a local problem. Because you turn off UAC, it's harder for you to tell if you have inadvertently introduced any other dependencies on full access to the system.
0 Kudos
DLee65
Level 13
For our implementation, we do not place the database files in the folders that Microsoft creates. There isn't anything that says that this is required. Instead we host the files in the application folder. You could prompt the user for a location if desired.

Once the files have been copied then I just execute a SQL Script to attach the databases.

Otherwise the application on startup is going to have to check to see if the database connection is healthy or if it needs to copy the database and prompt the user to restart the app as an administrator for the copy process. This is how my company actually handled the process since introducing SQL Server many years ago until I was hired and made it so that the setup handles attaching databases.
0 Kudos
sryan1977
Level 4

Changed approach by editing registry using bat file (see code below). I use the bat in a prereq. Works great now.

 

@echo off

REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /t REG_DWORD /d 0 /f

REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /t REG_DWORD /d 0 /f

shutdown /r /t 0

 

0 Kudos