I am attempting to disable UAC via a batch file with a REGEDIT command, and everything works - but, I need to be able to do this without clicking. When I run the:

REGEDIT /S somefile.reg

It works fine, except requires and initial click to allow this command. Is there any way around this? I am (temporarily) disabling UAC with the registry edit, but until then it is enabled. Thank you.

  • Well, first you need to disable UAC, and then you can... – womble Jul 19 '11 at 20:43
  • @womble - that is what the registry edit is doing, but until the registry edit runs, UAC is on - I am looking for a way around that. – naspinski Jul 19 '11 at 20:56
  • 3
    Apparently it's too early in the morning for sarcasm. – womble Jul 19 '11 at 20:58
  • It rather involves being on the other side of the airtight hatchway... – Evan Anderson Jul 19 '11 at 21:34

Chicken and egg, eh?

Seriously, though, what you're trying to do isn't "supposed" to be possible because UAC (though disclaimed by Microsoft as not being a formal security boundary) is a security boundary of sorts.

In a domain environment you should be controlling User Account Control from Group Policy (the "User Account Control: Run all administrators in Admin Approval Mode" setting under "Security Settings\Local Policies\Security Options" in the computer section of Group Policy is what you're probably looking for).

If you're in a non-domain environment then you'll need to run the script in an already-elevated context. As @womble says in his comment you'll need to bypass UAC in order to disable UAC without invoking UAC. A computer startup script would be one place that you could run this. To install it as a startup script, though, you'll have to be elevated. You're back to the chicken and egg, then.

  • 1
    It looks like UAC is doing exactly what it was designed to... damnit :P – naspinski Jul 20 '11 at 20:28

If you are accessing locations in the registry that does not require admin privileges you can use __COMPAT_LAYER environment variable.Just execute this before using regedit:

set __COMPAT_LAYER=RunAsInvoker

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.