how to find size of the content database in MOSS 2007 and no of site collectins and sub sites created
I am working as a sharepoint developer and would like to see the size of the content database is now and also need to find out how many sites we have created so far. CAn anyone please help me find out this information. we don't have administrator, but i have admin previlages.
Thanks开发者_C百科
If you can run stsadm (as you say in your comment), that means you have admin access, so you can run this in powershell
[Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") | out-null
$prop_Name = [Microsoft.SharePoint.Administration.SPContentDatabase].GetProperty("Name")
$prop_DiskSizeRequired = [Microsoft.SharePoint.Administration.SPContentDatabase].GetProperty("DiskSizeRequired")
$prop_Sites = [Microsoft.SharePoint.Administration.SPContentDatabase].GetProperty("Sites")
[Microsoft.SharePoint.Administration.SPFarm]::Local.Services |? {
$_.GetType().FullName -eq "Microsoft.SharePoint.Administration.SPWebService"
} |% {
$_.WebApplications |% {
$_.Name
$_.ContentDatabases |% {
$prop_Name.GetValue($_, $null)
$prop_Sites.GetValue($_, $null).Count
$prop_DiskSizeRequired.GetValue($_, $null)
}
}
}
SPWebService service = SPFarm.Local.Services.GetValue<SPWebService>();
foreach (SPWebApplication webapp in service.WebApplications)
{
Console.WriteLine("WebApplication : " + webapp.Name);
foreach (SPContentDatabase db in webapp.ContentDatabases)
{
Console.WriteLine("{0}, Nb Sites : {1}, Size : {2}, ", db.Name, db.Sites.Count, db.DiskSizeRequired);
}
}
note that "DiskSizeRequired" is the amount of disk space that is required for a backup.
精彩评论