Monday, August 10, 2015

How to get my site url and count in Sharepoint 2013 using powershell

#Add the SharePoint Snapin for PowerShell Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue #Get all MySite site collections. $sites = Get-SPSite -Limit All | ?{$_.URL -Like "*/personal/*"} #Make sure the number of site collections is correct! Foreach($site in $sites){$i +=1; Write-Host $site.url; if($i -eq $(($sites).count)){Write-Host `nTotal number of MySites: $(($sites).Count)}}

No comments:

Post a Comment