Jump to content
Sign in to follow this  
lapoigne

regedit and uac

Recommended Posts

lapoigne

Hello everyone,

I run an autoit script where I need to save and restore a key in registry.

This key is on HKEY_CURRENT_USER, so no need of admin right for the acces.

I execute this line:

RunWait('regedit.exe /s /e "' & @ScriptDir & '\portable-data\localbackup.reg" "HKEY_CURRENT_USER\SOFTWARE\thekey" ')

When I run the script with a Guest account or a normal user, all work fine.

But when the user is an admin and UAC is activated, I got an error

 

Error: Unable to execute the external program.

L'opération demandé nécessite une élévation.

It's because when you run regedit whis admin account the UAC popup, as you can edit other key such HKEY_LOCAL_MACHINE

If I run the script with admin privilege, it's work fine.

I can't use #RequireAdmin, as normal user don't need this permision.

Can I use regedit with admin user without uac ?

Can I use #RequireAdmin only if user is an admin (isAdmin() doesn't work if UAC not passed)?

Is there another solution with RegRead() with a loop on all subkeys to save in a file ?

Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×