Friday, July 19, 2013

SharePoint 2010 to 2013 Upgrade: Phase I "Cleaning". Unused spweb

As you may know Microsoft recommends to clean the farm first before migrating to a new version of SharePoint. (Clean up an environment before an upgrade to SharePoint 2013)

For my migration story SharePoint 2007 to SharePoint 2010, please refer to "SharePoint 2007 to 2010 Upgrade" online project

Now, I m in the process of migration SharePoint 2010 to SharePoint 2013.
I recommend to start cleaning from top to bottom.
First, check unused web applications - SharePoint 2010 to 2013 Upgrade: Phase I "Cleaning". Unused web applications

And finally, let's check what sites (spweb) are not in use

I took following principle to identify unused sites - if the site doesn't have content except the standard one ( ex: Master Page Gallery, one item in Announcements), it's considered an unused site.

To check the content , or to say more specifically, the itemcount in every list in the site, I use this PowerShell  script:

$rootSite = Get-SPSite  {site collection url}                                                                                                                                                                                                     
$rootSite.AllWebs | foreach {  $_.Lists | Select ParentWebUrl, Title, ItemCount |Sort ItemCount -Descending } |Export-Csv webs_content.csv

Once I have got data in the the file, I have created a simple pivot table to check sum of the items per site:
That gives me to determine which site doesn't contain user data (in my case the site the contains only 4 items:
default Announcement, and 3 items in the Master Page Gallery) 
And finally, delete unused sites:

$rootSite = Get-SPSite  {site collection url}                                                                                                                                                                                                       
$sitesToDelete = "{spweb relative url}";

foreach ($site in $sitesToDelete)
  $spweb = $rootSite.AllWebs[$site];
  $spweb.Lists| group ItemCount -AsHashTable
  "Web is deleted"

No comments:

Post a Comment