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.
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.
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: