Now contributing to the Blue Chip Blog!

As you may know, I work for Blue Chip Consulting Group – a Microsoft Managed Partner based out of Cleveland, Ohio. The Blue Chip website has been updated quite a bit over the last few months, and we’ve now launched the Blue Chip Blog as well. My first post on the Blue Chip blog site is now live, please feel free to check it out!

In the post, titled Automate Your Way to SharePoint Online Using Windows PowerShell, I discuss the history of PowerShell as it relates to SharePoint Server, and now SharePoint Online. I also include some details on a Blue Chip-developed tool, called BluePrint, which helps to automate SharePoint Online deployments by providing additional PowerShell Cmdlets beyond the native SPO cmdlets.

Happy Scripting!

Determine SharePoint 2013 My Site Usage with PowerShell

As a SharePoint consultant, I frequently encounter situations where a client / customer has My Sites deployed. However, nearly as frequently I’ll come across situations where they’re really not sure how many they have, who is actually using them, or if anybody is using them. While there are certainly GUI approaches to determining usage, PowerShell is a great, quick way to analyze an environment. Using the SharePoint Server Object Model, we can easily obtain this information.

Without further ado, here is a quick and dirty PowerShell function which can be used to determine My Site usage. Note: this will only tell you about My Sites with documents, feel free to tweak it for your usage:

function Get-SPMySitesWithData {
Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction stop;
[Object[]] $MySites = New-Object PSObject
$webapp = Get-SPWebApplication $MySiteHostUrl
$webapp.Sites | ForEach-Object {
$spweb = $_.RootWeb
$docsLib = $spweb.Lists["Documents"]
$siteSize = $spweb.Site.Usage.Storage/1MB
$siteSizeInMb = "{0:N2}" -f $siteSize
if($docsLib.Items.Count -gt 0)
[Object] $mysite = New-Object Management.Automation.PSObject;
$mysite | Add-Member -MemberType NoteProperty -Name SiteUrl -Value $spweb.Url
$mysite | Add-Member -MemberType NoteProperty -Name ItemCount -Value $docsLib.Items.Count.ToString()
$mysite | Add-Member -MemberType NoteProperty -Name "SiteSize(MB)" -Value $siteSizeInMb
$MySites += $mysite;
#Skipping my sites with 0 items, but if you wanted to do something with them here's where you'd do it!
Write-Output $MySites

To run it, simply treat it like a normal SharePoint PowerShell Cmdlet:

Get-SPMySitesWithData -MySiteHostUrl

And here’s what the object looks like once the function is complete: