Understanding 'Access Denied' so that permissions can be reverted - icacls and takeown

7,852

How to view permissions of Accessed Denied Folder in Windows 10

I guessed that system would be one user that would have access to this folder, so following after that thought I found a solution for running command prompt as system.

See - SO How do you run CMD.exe under the Local System Account?

  1. Download PStools from SysInternals, Microsoft.
  2. Run CMD as admin, navigate to folder of psexec.exe & psexec64.exe and run the following:
psexec -i -s cmd.exe 

or if you want 64 bit...

psexec64 -i -s cmd.exe
  1. Now a command prompt window has opened as system.

  2. Now we can view the permissions of the folder...

icacls C:\ProgramData\Microsoft\Windows\SystemData

C:\ProgramData\Microsoft\Windows\SystemData 
                                            NT SERVICE\TrustedInstaller:(F)
                                            NT AUTHORITY\SYSTEM:(F)
  1. Also an ACL can now be saved and resoted as described here
icacls C:\ProgramData\Microsoft\Windows\SystemData /save "C:\SystemData.acl" /t
icacls C:\ProgramData\Microsoft\Windows /restore "C:\SystemData.acl"
  1. In standard admin Command Prompt, not system, have yet to workout how to restore ownership like this after using takeown. Currently using the above System Command Prompt or ACL solution permissions can be restored. However have discovered that one can just run a batch script through task scheduler as System, then one does not need to change permissions.

Reading:

Share:
7,852

Related videos on Youtube

Giacomo1968
Author by

Giacomo1968

Updated on September 18, 2022

Comments