A previous article, "Two diagrams to see the SharePoint 2013 Farm logical architecture," talked about the relationship between Web Application,content database,site collection. With this logical structure diagram, this article will use PowerShell to more visually demonstrate the architecture of the SharePoint WebApplication.
SharePoint WebApplication Structure
As you can see from the illustration above, a webapplication can contain multiple content Database, and you can use PowerShell to view the content Databases that WebApplication contains.
Add-pssnapin Microsoft.SharePoint.PowerShell
#Get-spwebapplication | get-member#
get-spwebapplication |%{
write-host "' N-$ ($_. URL) ";
foreach ($cd in $_. contentdatabases) {
write-host "$ ($cd. Name) "
}
}
You can certainly get more accurate data, such as the size of the content database
Add-pssnapin Microsoft.SharePoint.PowerShell
get-spwebapplication |%{write-output "' N-$ ($_. URL) "; foreach ($cd in $_. contentdatabases) {
$ContentDatabaseSize = [Math]::round ($CD. DISKSIZEREQUIRED/1GB), 2)
Write-output " contentname:$ ($CD. Name) ' n size:$ ($ContentDatabaseSize) G "
}}
After you have obtained the content database, you can continue to delve into it, such as the site Collection contained in the content database, as well as a line of Poweshell to get.
Add-pssnapin Microsoft.SharePoint.PowerShell
#Get-spcontentdatabase | get-member#
get-spcontentdatabase |%{write-output "' N-$ ($_. Name) "; foreach ($site in $_. Sites) {write-output "$ ($site. URL) "}} >>c:\xx2.txt
Of course, you can also get the site collection size, the same way as the content database size, the same line PowerShell implementation.
Add-pssnapin Microsoft.SharePoint.PowerShell
get-spwebapplication |%{write-output "' N-$ ($_. URL) "; $_. Sites | Select URL, @{label= "Size in MB"; Expression={[math]::round ($_.usage.storage/1mb,2)}}| Sort-object-descending-property "Size in MB"}>>c:\tt.txt
Author: cnblogs Wood Wancheng Master
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/web/sharepoint/