The estimated reading time 2 minutes

Generate a folderstructure with the help of powershell from template with NTFS permissions

some customer asked me to help them creating a special folderstructure with ntfs permission in some subfolders. In my case we want to break inheritance beginning this subfolder.

folderstructure-powershell01Have a look at this simple structure

We want to generate a new project inside “folder02” so there should be a folder like project002 containing subfolders “01,02,03” (these subfolders should not have the same permissions from parent folder ) A special user with permissions should generate this as simple as possible.

So this is the challenge. ( Yes I know you should not break inheritance inside a folderstructure so this is not best practices)

So I wrote a little powershell script which asks the name of the folder in a textbox and let the user choose the folder where to generate the new project.

NOTE: you need of course a special user with the appropriated permissions who should execute this script

Enough said so here is my script on github

So have a look on my permission inside this structure


the first step is to change the variables as mentioned in the comments in top of the script (sourcepath in my case is the top folder of the template here C:\files\projecttemplate)

folderstructure-powershell03When you start the script it will ask for the name of the folder you want to create

folderstructure-powershell04After this it wants to know where to generate the folder and integrate the templates


If the script has finished there should be a folder “project002” containing folders with the same permission as template folders

folderstructure-powershell06See the overview of the new folders


The action should also be logged


After testing the script I generated a exe file with my brand new ISEsteroids ( so users can handle it as a normal program.

Give me some feedback concering this script.

Write a comment.

Thank you


Print Friendly, PDF & Email
  • Was this Helpful ?
  • yes   no