Get all SharePoint site collections and sites

If you want to get a list of all the site collections and sites from a web application you can use the following script.

Get-SPWebApplication <web app URL> | Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, URL| Export-CSV <filename> -NoTypeInformation

For example:

Get-SPWebApplication http://contoso.com | Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, URL | Export-CSV C:\sites.csv -NoTypeInformation

Copyright © 2018 SharePointNinja — Primer WordPress theme by GoDaddy