Bulk modification of SharePoint sites

Ever need to modify all of the sites in a SharePoint web application?  I never had to do this until we decided to roll out the powerful Telerik radEditor to all of our sites.  In the past, radEditor was scoped “globally”, meaning that once installed to the Web App, all sites started using it.  However, the current release is scoped “per site”.  To activate on all sites, we have to do a few things (well, a lot of things, really):

Here is the blow-by-blow:

  • Retract radEditor Lite (global scope version)
  • stsadm -o retractsolution -name radeditormoss.wsp
  • Download and install radEditor Full
  • Modify the “ONET.xml” file for each site template so that future sites have radEditor pre-activated
    • You will find one ONET.XML per site-template.  This file is located in the <Template>Xml subdirectory of “C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATESiteTemplates”
    • In the <WebFeatures> section of each ONET.xml, add the following:
    • <!– radEditor MOSS Feature –>
      <Feature ID=”747755CD-D060-4663-961C-9B0CC43724E9″ />
      <!– radEditor MOSS IE Feature –>
      <Feature ID=”F374A3CA-F4A7-11DB-827C-8DD056D89593″ />

  • obtain rights required to bulk-mod all sites
  • enumerate all site collections, convert to a usable control file
    • From “CMD”, run:
      stsadm -o enumsites -url [SharePointWebAppURL] > [enumsitesXMLfile]
    • The UNIX utility “CUT” will be used to trim out all XML code from the output file.  Sadly, there appears to be a bug in “CUT when executed from within CMD that prevents further standard output redirection or pipelining, so we now switch to a UNIX shell (cygwin “bash”, or the UnxUtils SH.exe):
      cat [enumsitesXMLfile] | cut -f2 -d” -s > [enumsitesTXTfile]
      unix2dos [enumsitesTXTfile]
      (We are “cutting” after the first text delimiter (or “field 2”) using the quotation mark as the delimiter.  Note that the quote character (“) needs to be escaped (). Use of UNIX2DOS will convert the UNIX-style output file to Windows semantics.)
  • enumerate all subwebs of all sites
    • FOR /f %s IN ([enumsitesTXTfile]) DO stsadm -o enumsubwebs -url “%s” | find “<Subweb>” > [subwebXMLfile]
    • In BASH:
      cat [subwebXMLfile] | cut -c11- | cut -f1 -d< > [subwebTXTfile]
      unix2dos [subwebTXTfile]
      (Here we use “cut” to trim after the 11th character in the source file, and then agan after the first “” character.)
    • Consolidate sites and subwebs into single control file
    • type [subwebTXTfile] > [masterTXTSiteList]
    • type [enumsitesTXTfile] >> [masterTXTSiteList]
    • Using GnuWin32 “sort” command:
      sort -du [masterTXTSiteList] > [masterSortedTXTSiteList]
  • Batch activation of radEditor features using the control file
    • FOR /F %s IN ([masterSortedTXTSiteList]) DO stsadm -o activatefeature -name radEditorFeature -url “%s” & stsadm -o activatefeature -name radEditorFeatureIE -url “%s”

    2 thoughts on “Bulk modification of SharePoint sites”

    1. Hi!

      Maybe a simpler sollution is to follow the instructions here: http://www.telerik.com/help/radeditormoss/Change_the_RadEditor_features_scope.html


      Q: How do I change the scope of the RadEditor features so they can be activated from the Site Collection features.

      A: You need to remove the features, change their scope, and finally install them again. First open a command prompt on the server and execute the following commands to remove the features:

      C:>stsadm -o uninstallfeature -name RadEditorFeature -force

      Operation completed successfully.

      C:>stsadm -o uninstallfeature -name RadEditorFeatureIE -force

      Operation completed successfully.

      Then open the feature definition files and change the scope attribute from “Web” to “Site”. The files you need to edit are:

      C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATEFEATURESRadEditorFeatureFeature.xml


      C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATEFEATURESRadEditorFeatureIEFeature.xml

      Open them with a text editor and change the line:


      Save the changed .xml files and install the features again:

      C:>stsadm -o installfeature -name RadEditorFeature -force

      Operation completed successfully.

      C:>stsadm -o installfeature -name RadEditorFeatureIE -force

      Operation completed successfully.


    2. That is an interesting suggestion. I had a look… what this procedure will accomplish is to change the scoping of the RadEditor from the individual site level (or “web”) to the site collection level (or “site”).

      While this is useful (it allows us to change our procedure so that we only need to activate RadEditor for all top-level site collections), it does not actually cause the feature to be activated globally.

      Again, if you want the RadEditor feature activated globally, you still need to modify your ONET.xml templates, discover all current sites, and activate.


    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out /  Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out /  Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out /  Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out /  Change )


    Connecting to %s