SharePoint Dragons

Nikander & Margriet on SharePoint

Monthly Archives: October 2013

Performance Hunting at SharePoint Connections Amsterdam 2013

This year, we’re speaking at SharePoint Connections Amsterdam 2013 (http://www.nccomms.com/Sharepoint_Connections/Home.aspx). We’re doing a session called “SharePoint 2013: Hunting Performance Issues” and we’re really looking forward to it. The first day of the conference starts at 19/11, and this conference is going to be so cool that Margriet decided to skip the MVP Global Summit (18-21 Nov) to be in Amsterdam. Maybe we’ll see you there?

Advertisements

PowerShell Maxer for SharePoint 2013

Checking Capacity boundaries was made simpler using our Maxer tool (http://gallery.technet.microsoft.com/office/Maxer-for-SharePoint-2013-52208636). We decided that it would be way easier to port the code to PowerShell (and then add some). This makes it easier for everybody to add or adjust sections according to personal or company liking.

PowerShell Maxer for SharePoint 2013 is a script that checks for capacity planning limits as described per the Planning section of the TechNet Wiki SharePoint 2010 Best Practices overview page at http://social.technet.microsoft.com/wiki/contents/articles/12438.sharepoint-2013-best-practices.aspx

PowerShell Maxer for SharePoint 2013 can do the following things:

· Checks user limit in groups.

· Checks list item limits.

· Checks site user limits.

· Displays group membership.

· Displays group owners.

· Analyzes all web applications, site collections, and sites in a farm.

· Displays which features have been activated at the farm, web application, site collection, and site level.

· Checks sub site limits.

· Checks site collection limits per content db.

· Displays site collection owner and creation date.

· Lists relevant application pool names.

· Checks user limit in site collections.

To get the idea, we’ve included some code snippets.

Here’s code for counting the number of list items:

Copy code

PowerShell

Edit|Remove

function CountLists($currentWeb) 

foreach ($currentList in $currentWeb.Lists) 

  { 

$sw.WriteLine(“There are {0} items in list {1}. A max of 30,000,0000 is allowed.”, $currentList.ItemCount, $currentList.Title) 

  } 

Code for counting members in a group:

Copy code

PowerShell

Edit|Remove

function CountGroups($currentSc) 

foreach($currentGroup in $currentSc.OpenWeb().SiteGroups) 

    { 

$sw.WriteLine(“Group {0} has {1} users. A max of 5,000 is allowed.”, $currentGroup.Name, $currentGroup.Users.Count) 

    } 

Code for counting all users in a site collection:

Copy code

PowerShell

Edit|Remove

function CountUsers($currentSc) 

foreach ($currentUser in $currentSc.OpenWeb().SiteUsers) 

    { 

$sw.WriteLine(“User {0} is a member of {1} groups. A max of 5,000 is allowed.”, $currentUser.get_Name(), $currentUser.Groups.Count) 

    } 

Code for finding group owners:

Copy code

C#

Edit|Remove

function CountOwners($ownersWeb) 

foreach($ownersGroup in $ownersWeb.Groups) 

    { 

if($ownersGroup.Name -like “*Owners*”) 

        { 

            $sw.WriteLine(“”) 

            $sw.WriteLine(“The following users are a member of the {0} group:”, $ownersGroup.Name) 

foreach($ownerUser in $ownersGroup.Users) 

            { 

                $sw.WriteLine(“User: {0}”, $ownerUser.Name) 

            } 

        } 

    } 

Code for counting sub sites and displaying activated site features:

Copy code

PowerShell

Edit|Remove

function Countwebs($currentSc) 

foreach ($currentWeb in $currentSc.AllWebs) 

    { 

$sw.WriteLine(“”) 

$sw.WriteLine(“Analyzing Web site {0}”, $currentWeb.Title) 

        CountOwners $currentWeb

$sw.WriteLine(“”) 

$sw.WriteLine(“The following features are active at Web scope:”) 

$contentWebAppServices = (Get-SPFarm).services  

$webFeatures = Get-SPFeature | Where-Object {$_.Scope -eq “Web” } 

if ($webFeatures -ne $null) 

        { 

foreach ($feature in $webFeatures) 

               { 

if ((Get-SPFeature -Web $sc.Url | Where-Object {$_.Id -eq $feature.id}) -ne $null) 

                  { 

$sw.WriteLine(“Feature: {0}, Typename {1} with GUID {2} is hidden {3}”, $feature.DisplayName, $feature.TypeName, $feature.Id, $feature.Hidden) 

                  } 

               } 

        }     

$sw.WriteLine(“”) 

$sw.WriteLine(“Web site {0} has {1} sub sites. A max of 2,000 is allowed.”, $currentWeb.Title, $currentWeb.Webs.Count) 

        CountLists $currentWeb

$sw.WriteLine(“”) 

    } 

Code for counting site collections in content db’s:

function CountContentDatabases($currentWebApp)
{
foreach($currentCd in $currentWebApp.ContentDatabases)
{
  $sw.WriteLine(“Content database {0} has {1} site collections. The maximum supported is 10,000. Recommended is a maximum of 5,000.”, $currentCd.name, $currentCd.Sites.Count)
}
}

And so on… Get the full PS script via the download link at http://gallery.technet.microsoft.com/office/PowerShell-Maxer-for-cd9e13d6