The purpose of this post is to help you understand when to use InstantQuick SharePoint Provisioning and when to use OfficeDev PnP-PowerShell by contrasting the two. At the outset I will admit I am biased as I created the former, but I also use the latter. And, not to put the conclusion before the comparison, I think both have a place in your toolbox. Each PowerShell module gets its functionality by wrapping a set of class libraries that you can use independently of the module in your own solutions, and so a comparison of the PowerShell modules is also a comparison of the class libraries they wrap which are also open source and located in GitHub.
Where InstantQuick SharePoint Provisioning Shines – Templated Provisioning
PnP and IQ each offers the ability to create provisioning templates by reading from an existing site and the ability to deploy the resulting templates to other SharePoint sites. PnP has a number of other very useful and granular features. At the time of this writing PnP offers 170! individual PowerShell commands. Most of these are not for creating provisioning templates or application of provisioning templates, but are instead for administration and manipulation of individual elements of a SharePoint tenant or site. Examples include such diverse commands Send-SPOMail, Enable-SPOFeature, and Get-SPOTimeZoneId. Most of the commands wrap types from the SharePoint Client Object Model which are extended by OfficeDevPnP.Core.dll.
I’ll talk about these PnP commands in general in the next section. In this section I’m comparing the primary PnP commands dedicated to templating and template provisioning. These are:
PnP has two different package formats and there are a few other commands in PnP for the management and conversion of the templates themselves that are outside the scope of this comparison as they don’t affect the actual provisioning functionality.
In contrast IQ has only 24 PowerShell commands, is considerably less granular, and is more or less focused on creating, installing, and uninstalling provisioning templates. IQ offers two types of templates: AppManifest and SiteDefinition. An AppManifest describes fields, content types, lists, etc. and a SiteDefinition defines a hierarchy of one or more Webs each with a corresponding AppManifest. To keep this comparison simple, I’ll focus on only the two commands that most closely match PnP:
For a more detailed look at the IQ commands in action see the samples on GitHub. For this comparison I am using the Board of Directors Site sample. If you’d like to play along at home, use IQ to create a site for this samples, use PnP to create a template from the sample site, and then apply the PnP template to another site for comparison – do not use the same site collections or the items will collide!
Get-SPOProvisioningTemplate Versus Get-WebCreator
Each of these commands creates a template by reading from a site that contains customizations. Get-SPOProvisioning determines what to include by comparing the site to an XML document embedded in the PnP stack whereas Get-WebCreator compares the site with the customizations with another site to produce a delta. Here at InstantQuick we prefer the latter because we don’t have to maintain a static template as Microsoft changes SharePoint between versions but primarily because we treat AppManifests as modules we combine to produce larger customizations. For example, our Practice Manger apps are composed of many different manifests, some of which are shared making customizations and maintenance much easier. To create a custom solution for a client we can install a base solution to a site, modify it, and extract the delta as a new package. To deploy it, we install the AppManifests in order so that the delta takes precedence over the original.
Big Difference #1 – Support for Pages with Web Parts
One side-effect of the PnP approach is that they have different installers for different versions of SharePoint. At present there are three, SP2013, SP2016, and SharePoint Online. This can be a pain if you work with more than one version of SharePoint. The core PnP solution uses build configurations and conditional compilation to deal with the differences between versions whereas IQ has one build configuration with conditional logic and heuristics to decide how to behave at runtime based on the server’s version.
If you are using a version of PnP compiled for a version where the Client Object Model doesn’t support a particular operation, for example reading a Web Part definition from a page in SharePoint 2013, PnP will simply skip those steps. Among IQ’s conditional logic is code that will fall back to older SOAP based API’s as necessary to read Web Parts and 2010 style workflows.
PnP therefore doesn’t support Web Part, Wiki, or Publishing Pages that contain Web Parts for anything but the newest versions of SharePoint and (as far as I can tell) doesn’t support SharePoint 2010 workflows at all.
Big Difference #2 – Site Specific Fixups
Both Get-SPOProvisioningTemplate and Get-WebCreator will include the source site’s home page in the template by default. The screen shots below are from sites created by IQ and PnP respectively. The PnP version was created from a template produced by using Get-SPOProvisioningTemplate against the IQ version and then applying the template to a web in a different site collection.
The second site’s home page looks pretty good, but unfortunately all of the URLs in the template point to the original site. This includes the navigation links, the image’s source URL, etc.
Get-WebCreator tokenizes a variety of things including URLs, list IDs, and group IDs in links, filed, web parts, and files. Install-IQAppManifest substitutes the correct values during provisioning and does things in the proper order when necessary. Both Get-SPOProvisioningTemplate and Apply-SPOProvisioningTemplate simply read the values and reproduce them on the target without modification.
Example one from IQ
Example two from PnP
Big Difference #3 – Creation of Complete Templates
If you are following along at home, there are a number of other differences you will quickly notice. Among them are the fact that the Board Events list has a workflow that is missing in the PnP site, that the Meeting Minutes library has a custom document template that is missing in the PnP version, and that several of the lists have custom view pages that are missing in the PnP version. To be fair, Get-WebCreator won’t include all of these files by default as part of the differencing process, but it will if you use the -Options switch to specify the lists and libraries with items you wish to include. You can also extend a created template using IQ commands such as Get-FileCreatorAndFolders and Get-ListCreatorListItems.
PnP has the ability to extend the provider with custom handlers for such situations, and the Office PnP samples repository has samples for just about anything you might want to do, but to get a complete template generally means you will have to understand PnP at a fairly deep level and be willing to write a bunch of code.
Where OfficeDev PnP-PowerShell Shines – Formal and AdHoc Admin Scripting
If you are responsible for a SharePoint environment and you use PowerShell, I have no reservations saying that you should be using OfficeDev PnP-PowerShell.
You need to add a file to 1000 sites? Add-SPOFile
You need to clean up some dodgy Custom Action that’s breaking a site? Remove-SPOCustomAction
You need to ….? I could go on all day because PnP has 170 really useful commands!
I could wax poetic all day about the good things in PnP, but it isn’t my project. J