**SITE COLLECTIONS AND DATABASES** In some cases, for example when analyzing or optimizing the distribution of Site Collections in a SharePoint farm, it may be helpful to see which Site Collections are stored in which Content Databases. This can easily achieved by using this SharePoint Management Shell cmdlet: Get-SPSite -Limit All | Select Url,ContentDatabase | Format-Table -Wrap -AutoSize > D:\Output\ShowAllSCs.txt Alternatively it may also be helpful to dispaly all Site Collections in a certain Content Database: Get-SPSite -Limit All -ContentDatabase | Format-Table -Wrap -AutoSize > D:\Output\ShowSCsInContentDB.txt Or display all Site Collections in a certain Web Application: Get-SPWebApplication https://webapplication.domain.com | Get-SPSite -Limit All | Select Url,ContentDatabase | Format-Table -Wrap -AutoSize > D:\Output\ShowAllSCsInWA.txt ____________________________________________ **SITES IN WEB APPLICATION** Add-PSSnapin "Microsoft.SharePoint.PowerShell" get-spsite -Limit All -WebApplication https://ucshare.canterbury.ac.nz | Select Url, Title | Out-File -FilePath "C:\scripts\export\spSitesUCshare.txt" Add-PSSnapin "Microsoft.SharePoint.PowerShell" get-spsite -Limit All -WebApplication https://ucshare.canterbury.ac.nz | Select Title, InternalName, ID, Url | Out-File -FilePath "C:\scripts\export\spSitesshare.txt" Get-SPWeb -site http://sitename/sites/site **SITES IN WEB APPLICATION with databases** Add-PSSnapin "Microsoft.SharePoint.PowerShell" get-spsite -Limit All -WebApplication https://share.canterbury.ac.nz | Get-SPSite | Select InternalName, contentdatabase | Out-File -FilePath "C:\scripts\export\spSitesUCshare.txt" Get-SPWebApplication https://share.canterbury.ac.nz | Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, URL, Last_x0020_Modified | Export-CSV C:\scripts\export\InfoArch.csv -NoTypeInformation uppercase on Limit All seems to be quite impt ____________________________________________ **SITES IN WEB APPLICATION** Add-PSSnapin "Microsoft.SharePoint.PowerShell" get-spsite -Limit All -WebApplication https://ucshare.canterbury.ac.nzz | Select Url, Title | Out-File -FilePath "C:\scripts\export\spSitesUCshare.txt" Add-PSSnapin "Microsoft.SharePoint.PowerShell" get-spsite -Limit All -WebApplication https://ucshare.canterbury.ac.nzz | Select Title, InternalName, ID, Url | Out-File -FilePath "C:\scripts\export\spSitesshare.txt" _____________________________________________ **SITES IN WEB APPLICATION with databases** DO NOT RUN THIS IF YOU ARE NOT CONFIDENT USING POWERSHELL Add-PSSnapin "Microsoft.SharePoint.PowerShell" get-spsite -Limit All -WebApplication https://ucshare.canterbury.ac.nz | Get-SPSite -Limit All | Select url, contentdatabase | Export-CSV C:\scripts\export\File.csv –NoTypeInformation Get-SPWebApplication https://share.canterbury.ac.nzZ | Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, URL, Last_x0020_Modified | Export-CSV C:\scripts\export\InfoArch.csv -NoTypeInformation