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

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.


Have 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)


When you start the script it will ask for the name of the folder you want to create


After 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


See 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
0 0 votes
Article Rating
Notify of
Oldest Most Voted
Inline Feedbacks
View all comments
1 year ago


is this script working recursively when having a bunch of sub folders?


1 year ago

Hi A.K.,

Thanks for the script, I wonder if it’s possible via powershell, to add a step in the script, which allows the user to choose a subset of the folders in the template eg via a checkbox – folder treeview. I’ve found a solution via Python, but would prefer to use powershell.


Reply to  A.K.
1 year ago

Hi Alexander,
Thanks, but from what I could find: the basic FolderBrowserDialog does not support a multiselect action.
For my purpose, I would need to have the user make a (multi)-selection of the folders that are in the template folder structure.

5 years ago

I need a Windows 10 powershell script that can MOVE multiple files that are inside multiple folders (in which each file has an extension of “.wmv”), to another single external drive. All these .”wmv” files can keep their existing permissions in their new location, although they can carry temp permissions if this makes it easier.
Is it possible to build such a script possible?
Thnaks so much for your awesome knowledge.