D
D
Dmitry Shumov2019-07-12 16:22:44
PowerShell
Dmitry Shumov, 2019-07-12 16:22:44

How to become the owner of a registry branch and delete it?

Colleagues, there is a need to delete the registry branch: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AlternateShells on many servers. But first, you need to become the owner of this branch and give the administrator group full rights to this branch. I'm trying to "muddle" a batch file:

subinacl.exe /subkeyreg "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AlternateShells" /setowner=Administrators /grant=Administrators=f
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AlternateShells /f

but it doesn't come out. Maybe I'm doing something wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Tsvetkov, 2019-07-12
@tsklab

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
Quotes and the root as already indicated.

E
Ezhyg, 2019-07-12
@Ezhyg

Is the subinclusion installed?
Well, just after that, some branches have strictly defined permissions, and for each nested branch they have their own even if they are the same (for example, not inherited or the owner is the system), so you need to become the owner several times, including for each nested branch. If this is done from the registry editor, for example, then you have to enter each previously inaccessible branch, then go up and set yourself the owner of the branch and all nested ones again, sometimes 5 times.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question