Activating a feature for all SiteCollections within a WebApplication – MySites

Recently I had to get a feature activated over all 800 MySite of a Farm. The approach I choose was to generate an xml list of all the MySIte URL's in my farm and use a Windows application to read the XML file and generate the appropriate activation script.

a) The step to get all the site collections within the WebApplication hosting MySite is to run the command of stsadm -o enumsites -url http://moss:34078/ >C:\MySiteList.XML . This xml file would include the URL of all mysites in an XML Node.

b) Assuming all your mysites are under http://moss:portnumber/sites/personal/, the next thing you need to do is simply load the XML File in an XML domdocument and generate the appropriate activation script as stsadm -o activateFeature -url <<URLfromtheXMLNode Element>>. Remember to filter out the urls which do not begin with http://moss:portnumber/sites/personal/. And you are done. The script can be outputted to a .bat file which you could run later to activate the feature.

You also could do the same using API of SharePoint by looping through the site collection list of a particular webapp. My personal choice would be to go with the above for its simplicity.

Skip to main content