SharePoint is really a great tool. We can easily create lists and libraries with all the columns for metadata we need. All just with using the web interface of SharePoint. When we need to create content types to build some more structure for our lists and libraries, we can do it via the web interface, too. And, when I need to do any other setting in my site, do any regional or language setting or activate any additional feature, just do the necessary clicks in the site settings in the web interface. So, why the hell should I use PowerShell or any other automation tool to create the site structure?
When we work in iterations (a good practice today), our automation scripts easily can make modifications or extensions to our former development. Because we know the id’s, the internal names of the artefacts and the structure, we can easily reconfigure the site to our needs.
And, when we at first do not know how we can do something with scripting, because we do not know, where and how a setting is stored, we can first configure in the web interface and then investigate in tools like the SharePoint Client Browser.
So, what are the pro’s and con’s for automation with PowerShell?
- Full control on id’s and internal names
- Ability to provide an iterative approach for the solution deployment
- Providing additional development is easy, because all objects are well known
- The solution is reproduceable in any other environment or tenant
- Scripting means typing in files and for some SharePoint objects that is time consuming
- Because it’s so easy, to configure a site structure in the web interface, most customers won’t believe that defining a site structure will cost that time
My advice from my own practical use and all my former SharePoint projects is, whenever you need to transport your solution from your development environment to any other stage (eg. the environment of your customer), use a PowerShell script to automate the creation of the site structure. Reduce the manual steps for a deployment to a minimum (the same as when we do any other development and need to deploy our solution). When you have developed any other kind of software that works with your SharePoint environment, also use automation to do the deployment.
And, have in mind, there is another advantage, when using scripts and automation: you can reuse the objects and code you have developed. The strength, when developing today is, to reuse anything we have already done in any other project. Doing this, when defining a site structure via the web interface, is impossible.