Automated creation of a default Configuration Manager folder structure

configmgr-automated-folder-structure

TLDR: https://github.com/markhallen/configmgr/blob/master/New-CMFolders

We regularly create Configuration Manager hierarchies for new customers and we like to standardise the organisation of the different object types.

For this reason automation provides expediency, convenience and conformity.

The New-CMFolders PowerShell script will accept a CSV file of the desired folder structure and create the folders therein.

Mandatory parameters

The script accepts two mandatory parameters.

  1. -SiteCode indicates the Configuration Manager site code in order to initiate the connection to the site server.
  2. -Path is the path to the CSV file containing the desired structure.

Optional parameters

  1. -CustDirectory allows a default top level directory to be defined. This is useful for a hierarchy that is shared between distinct departments or organizational units.

-CustDirectoty param omitted

default

-CustDirectory param set to PST

custfolder

Limitations

Our current requirements only necessitate four directory levels be defined. A future development of the script might include a higher number of subdirectories handled dynamically.

Download and use

You can download the working script and example CSV file from github here.

If the Configuration Manager hierarchy is not shared or divided into organisational units then you can execute the following command in PowerShell.

If you have a shared hierarchy or maintain separation between organisational units then you can add the -CustDirectory parameter to the command line. This will create a top level folder in the root node of each object type and create the sub folders within.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Please complete the calculation *