Would a reg command run from a batch file require admin perms?

0

Would something like:

reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Run\ /v %keyname% /t REG_SZ /d "%expath%"

require administrator privileges to be able to execute from a batch file?

Raymo111

Posted 2018-10-27T15:58:34.337

Reputation: 103

Answers

3

Whether it requires admin permissions or not, is not the actual question you need to ask.

Registry keys, just like the NTFS file system, have Access Control Lists controlling who has access to that particular key.

You can check the permissions of the registry key by right-clicking it in regedit and choosing properties. If the user or group you intend to run the batch file under does not have appropriate access to the key, it will not be able to modify it. It’s possible that even the administrator doesn’t have access to the key.

Typically, HKLM is the computer wide settings that require admin permissions. The HKCU key is per user and the user usually has full control on those keys.

More info here: https://docs.microsoft.com/en-us/windows/desktop/sysinfo/registry-key-security-and-access-rights

Appleoddity

Posted 2018-10-27T15:58:34.337

Reputation: 9 360

So how can one edit the key if the admin does not have perms? – Raymo111 – 2018-10-27T19:36:59.283

@Raymo111 The admin takes ownership and changes the permissions. The admin can do that. – Appleoddity – 2018-10-27T19:48:08.083