how to find size of the content database in MOSS 2007 and no of site collectins and sub sites created

两盒软妹~` 提交于 2019-12-08 13:50:17

问题


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


回答1:


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)
        }
    } 
}



回答2:


  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.



来源:https://stackoverflow.com/questions/5007180/how-to-find-size-of-the-content-database-in-moss-2007-and-no-of-site-collectins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!