Wednesday, February 21, 2018

How to get sizes of MOSS 2007 application sites and sub-sites under it

In SharePoint 2007, we can use STSADM command line tool to get the size of all sites and sub site.

C:>STSADM -o enumsites -url "SITE-URL"

This command will provide result in below XML format, where StorageUsedMB attribute will provide the size of site consumed at present.

<Site Url="<SITE-URL>" Owner="<DOMAIN\ACCOUNT>" ContentDatabase="<CONTENT-DATABASE-NAME>" StorageUsedMB="<NUMBER>" StorageWarningMB="<NUMBER>" StorageMaxMB="<NUMBER>" />

If you run this command in command prompt and if it says, “STSADM is not recognized as an internal or external command, operable program or batch file” then you need to either set the STSADM full PATH OR you need to open the command prompt, open STSADM application directory path to run this command again.

STSADM application path is “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin\STSADM.EXE” on any WFE of SharePoint 2007 server.

How to get SharePoint site URL from Content DB

This command is applicable to Microsoft Management Shell tool for SharePoint 2010 or higher version. Open the Management Shell and type below command

P:>Get-SPSite -Limit All -ContentDatabase "="<CONTENT-DATABASE-NAME>" | select url

This command will provide list of all sites associated with above content database.

How to enable or disable the SharePoint Verbose Logs

During troubleshooting of any SharePoint related issues, it is very important for any SharePoint developer or engineer to enable the Verbose Logs in order to get more and more detailed logs.

Use your Microsoft Management Shell tool for SharePoint 2010 or higher version and run below commands in order to enable the verbose logs

P:>Set-SPLogLevel -TraceSeverity verbose -EventSeverity verbose

Run below command in order to disable the verbose logs


Run below command in order to get new log file


Run below command in order to merge logs by Correlation ID

P:>Merge-SPLogFile -Correlation "CORRELATION-ID"