Use PowerShell to Export a List of My Sites

How many My Sites (MySites) are currently enabled in my Farm?

if(-not(Get-PSSnapin | where { $_.Name -eq "Microsoft.SharePoint.PowerShell"}))
{
      Add-PSSnapin Microsoft.SharePoint.PowerShell;
}

$site = Get-SPsite "http://mysite.sharepointed.com/"
$spWebApp = $site.WebApplication

$log = "c:\test.txt"

foreach($site in $spWebApp.Sites)
{
    $site.url |	Out-File $log -Append
    $site.Dispose()
}

load the powershell snapin.
get the Web App hosting your My Sites.
set a variable to where you want the script to output the results to.
loop through all the sites in the Web App, and output them to your text file.

Leave a Reply

Your email address will not be published. Required fields are marked *