11

I found an awesome Reg Hack for Windows 7, that renames the 'Computer' icon to something like %username% on %computername%. Unfortunately, in the tutorial, it says to change permissions of the registry key. I would like to change this from the command line, in a batch file, then add that tweak, then lock down that key again, all in one file. Is this possible? If so, how?

Canadian Luke
  • 24,199
  • 39
  • 117
  • 171
  • Similar question: https://serverfault.com/questions/331046/change-permissions-on-registry-key-via-command-line – Vadzim Feb 20 '23 at 02:06

2 Answers2

12

I found my way around another utility, SetACL. I pushed the file out to some systems, then ran the following commands remotely. They succeeded, and the icon changed on those systems after doing an F5 on the Desktop.

SetACL.exe -on "HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -ot reg -actn setowner -ownr n:Administrators
SetACL.exe -on "HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -ot reg -actn ace -ace "n:Administrators;p:full"
reg import computername.reg
Canadian Luke
  • 24,199
  • 39
  • 117
  • 171
3

You can also use Subinacl.exe (Official tool from Microsoft for managing permissions).

To change users permissions for a special registery key and its subkeys you can write sommething like this (copy the Subinacl.exe file in C:\Cindows\system32 to use it directly as a standard command in cmd ):

> subinacl.exe /subkeyreg HKEY_LOCAL_MACHINE\SOFTWARE\POLICIES\MICROSOFT /grant=Everyone=f
Andy McRae
  • 324
  • 3
  • 9
  • Last Syntax Error:WARNING : /grant=everyone=f : Error when checking arguments - HKEY_LOCAL_MACHINE\SOFTWARE\POLICIES\MICROSOFT – acgbox Aug 25 '21 at 17:19
  • Hi I just checked the code and it worked fine. In the output you get sometthing like --> HKEY_LOCAL_MACHINE\SOFTWARE\POLICIES\MICROSOFT\SystemCertificates\TrustedPublisher\Certificates : 1 change(s) --> SOFTWARE\POLICIES\MICROSOFT\SystemCertificates\TrustedPublisher\CRLs : new ace for \everyone HKEY_LOCAL_MACHINE\SOFTWARE\POLICIES\MICROSOFT\SystemCertificates\TrustedPublisher\CRLs : 1 change(s) You should check if you put the spaces correctly between the exe, the parameters etc. – Andy McRae Aug 26 '21 at 08:49