I am trying to delete the following registry key via CMD but am getting "ACCESS DENIED"
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Pastel
- The above registry cannot be deleted manually as it gives an error
To deal with Permissions I've used PSExec and ran the following command as administrator, which brings up Registry Editor with supposedly full Permissions but I still cannot delete the registry key
psexec -i -d -s c:\windows\regedit.exe
I am running Windows 7. How can I grant permission and delete the registry key from CMD using script or at Windows start-up?
Edit: Above registry and its sub-folders has following permissions.
CREATOR OWNER: Special Permissions ----> If I Disable Inheritance and change permission to grant full access as soon I hit OK and right click>permission the Full access resets to special permissions.
SYSTEM: Full Control, Read Administrators: Full Control, Read Users: Full Control, Read
Edit#2:
I've used following script but still no success
REM ----------------------------------------------------------------
cd /d %~dp0
@ECHO OFF
Title Replacing permissions on HKEY_CLASSES_ROOT\DesktopBackground\Shell\Display
setacl.exe -on "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Pastel" -ot reg -actn setowner -ownr "n:Administrators"
Pause
REG DELETE HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Pastel /f
Pause
Exit
REM ----------------------------------------------------------------