How to automate this process: Folder Disable inheritance --> Remove all inherited permissons from this object

Hi there, I am in trouble with it help desk automation process.

I have to remove all inherited permissions from folder. Is there any alternative way to automate this process easily?

Manually it can be done by doing this step

  1. [Open File Explorer]
  2. Locate the file or folder you want to take disable inherited permissions for.
  3. Right-click the file or folder, click Properties, and then click the Security tab.
  4. Click on the Advanced button. The "Advanced Security Settings " window will appear.
  5. Click on the Disable inheritance button.
  6. You will be asked either to convert inherited permissions into explicit permissions or to remove all inherited permissions.
  7. Choose Remove all inherited permissons from this object.

Thank you in advance


Please check this and try the invoke vbcode


I tried to use invoke code with this script, as an argument fileName assign to exact path but got error.
Can you please explain me more?


Use sytem.Security.AccessControl.FileSecurity



This should solve those