Working with Windows File and Folder NTFS Permissions (Copy and Reset)

There have been a few times recently where I’ve had end users do some weird things to either their desktops or development servers they have been working on. If they’re on Dev servers we usually just restore the servers from backup but sometimes we just need to do a quick fix. The most common issues I find are around permissions (web develpoers tend to muck around with c:\inetpub\wwwroot a lot). I’ve got a few tricks up my sleeve to deal with it.

Copying permissions from on folder to another is straight-forward with PowerShell

Get-Acl -Path 'C:\DemoFolder' | Set-Acl -Path 'C:\NewDemoFolder'

Other times I find we just need to reset the folder permissions back to what Windows believes the default is

icacls * /T /Q /C /RESET

Another thing is sometimes ownership info needs to be reset too, you can do that with the following command.