Template Design Sync: Multiple Project Sites (PowerShell)

November 30, 2012 by

BrightWork 11 for SharePoint 2010 introduced a new feature to BrightWork, the Template Design Sync. This feature allows you to “Bind” a site or sites to a template site, modify the design of your template site, and then pull the design changes from the template site into your project site(s) using the Sync Design page.

The Template Design Sync has been designed so that the interface only permits you to update project sites on an individual basis and it is not possible in the interface to update multiple sites in one step. This is the safe and prudent approach, and is the mode of operation BrightWork would very much recommend. However, it is not always going to be the most satisfactory means to update project sites, especially large numbers of project sites that are not likely to be customized other than through the template. In these scenarios another approach is needed and for this reason we have created a means that makes it possible to update multiple project sites from a template using SharePoint PowerShell.

PowerShell Scripts Overview

To provide as much granularity as possible the PowerShell scripts have two main components that are run in sequence. The first component is run to determine which project sites exist based on a named template and generates a PowerShell script to update these project sites. This generated PowerShell script then is the second component and it can then either be run as is, or modified before being run. This gives great flexibility into which project sites get updated.

Before you start we recommend that you check which project sites will be impacted by a Template Design Sync. There are two quick ways to do this:

  1. Navigate to the ‘Templates Area’ and select ‘Sites Actions’ –  ‘Template Usage’ and pick the template to check for
    or
  2. Navigate to the specific template and select ‘Sites Actions’ – ‘Site Settings’ – ‘Determine Template Usage’ and click on ‘Locate

Doing this will give you an idea of the scope of the changes to be applied, give you visibility to any project sites you might want to exclude from the Template Design Sync, and also gives you an opportunity to contact other interested parties so that there are no surprises for people.

PowerShell Steps

To setup this PowerShell cmdlet for your server follow these steps:

  1. Download the zip file from the BrightWork Product Templates and Utilities Download page to a location on your SharePoint server e.g to c:\BrightWorkDesignSyncScriptsBrightWorkMulti-ProjectTemplateDesignSyncPowerShell.zip
  2. Extract the GenerateDesignSyncWithCustomSettingsForSpecifiedTemplate.ps1 file from the zip file

Stage 1: Generate a PowerShell to update project sites

  1. Start SharePoint PowerShell by right-clicking on the SharePoint Management Shell and selecting Run as administrator
  2. Change the directory to the location of the downloaded PowerShell .ps1 script e.g. cd “C:BrightWorkDesignSyncScripts”
  3. Enter the name of the PowerShell script preceded  by . and the absolute URL of the template to use in the following format:
    .GenerateDesignSyncWithCustomSettingsForSpecifiedTemplate.ps1 “http://server/sites/sites/templates/templateName”
  4. This PowerShell script will do the following:
    1. Check that the URL provided is a valid BrightWork template site that has project sites bound to
    2. Check if a PowerShell script has already been generated for this template, and if so, the PowerShell script will stop providing you with an opportunity to either reuse the existing file, rename it or delete it
    3. Create a new PowerShell script called: “SyncProjectsBasedOnTemplateTemplateTitleTemplate.ps1” where the TemplateTitle is the title of the template site.
      For example, if the template title is “Project Lite then the PowerShell script generated will be called “SyncProjectsBasedOnTemplateProject LiteTemplate.ps1”
  5. Once this PowerShell script is generated, you will to decide which settings you want to use.
    Search for “Log Settings”. Below the Log Settings, and go through the settings and change $false to $true for the settings you wish to Design Sync
    To exclude a project site from the sync, comment it out using a hash ‘#’ character as follows.

Stage 2: Update Projects sites

  1. Run the generated PowerShell script to performance a Template Design Sync for each project site listed:
    .”SyncProjectsBasedOnTemplateTemplateTitleTemplate.ps1” | Out-File -filePath “C:BrightWorkDesignSyncScriptsTemplateTitleTemplateLog.txt”
  2. The following information will be written to the specified log file for each project site updated:
    1. Time taken
    2. Number of information messages
    3. Number of  errors messages
    4. Number of log messages
  3. Exit the SharePoint Management Shell
  4. Once complete, you should check the Log file for any issues
  5. At this point you should have some newly Template Design Synced project sites!

Note: This script will use the default setting for the Template Design Sync, so for example, it will not update the Home page. The next Technical Blog entry on Template Design Sync will include the PowerShell commands to change the default Template Design Sync settings.

For more information

Latest posts by Bróna O'Donnell (see all)

    Pin It on Pinterest

    Share This