0

i want to automate something, but it only works if i manually accept the uac window, so i tried to change the registry value with this commads:

c:\Windows\System32\cmd.exe /k c:\Windows\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f

But it only works if i run the cmd as administrator. So again i need to accept the uac window to deactivate the uac windows...

Is there a good way to make this with a script ore something like that, or is there a bypass solution? (for automation puroses)

Meso
  • 11
  • 2
  • 1
    In short: (a) There is no way around requiring elevation (running as admin) in order to modify the `HKEY_LOCAL_MACHINE` registry hive. (b) Deactivating UAC is not recommended, because it persistently removes an important security feature. The best solution is to use an invocation mechanism that allows elevation with stored admin credentials, such as a scheduled task (which can also be invoked _on demand_) -see [this answer](https://stackoverflow.com/a/50555081/45375). – mklement0 Oct 01 '21 at 15:01
  • 1
    When you go shopping for a lock you wouldn't expect the maker of that lock to implement a feature that allows everyone to open it. Why are you asking for this when it comes to operating systems? – IInspectable Oct 01 '21 at 15:27

1 Answers1

1

If you want to modify a registry hive without administrative privileges, you have to do it offline1.

To do so, you can boot into WinRE and then use regedit to modify your hives offline. You can also remove your hard disk and put it into another computer where you have administrative privileges and modify it there.

You can find an example here.


1 Offline in this case means, the hives are not mounted. Or in other words, the Windows installation is not running.

stackprotector
  • 10,498
  • 4
  • 35
  • 64