Monitoring and cleaning site content is an important best practice in SharePoint, since cleaning of out-of-date and unwanted data will free storage and as a result, administrative resources. It will also improve the performance of the SharePoint farm.
Monitoring the site usage
Tracking usage information can be useful for identifying which content on your site is being heavily used and which content is not being heavily used. An administrator can check site usage statistics; track how much storage space each site is taking up and the level of activity that each site is generating. SharePoint gathers this information as part of the quota tracking for sites. Summary and detailed usage reports supply information such as the following:
- Number of hits per page
- Number of unique users
- Referring domains and URLs
Monitoring also helps to isolate problems if it is browser-specific, site-specific or user-specific.
Determine obsolete and underutilized site content
Content in SharePoint needs to be checked intermittently to check for unused and underutilized data and brought to the attention of stakeholders. If unused content continues to grow then there will be a need to add extra servers and hence spend more on licenses and hardware. An administrator can find the inactive sites in multiple ways as follows:
- Using automated third-party tools
- Run PowerShell scripts
- Send email notifications. For example: if you plan to automatically delete unused site collections then you need to configure how many email notifications are to be sent. The email notification can contain links to confirm whether a site collection is active or inactive. There are three possible outcomes:
- The site collection owner can confirm that the site collection is active by clicking the confirmation link in the email notification.
- The owner continues to receive periodic email notifications according to the interval specified by a member of the Farm Administrators group until the site collection owner confirms that the site collection is active or deletes the site collection.
- If the site collection is not active then the site collection is deleted automatically if the site collection owner does not confirm the status of the site collection.
You can have other Governance mechanisms of internal communication with site owners and administrators to get web site deletion confirmation. The owners of the site may no longer be around (given the higher turnaround of people). You need to ensure that the site is not needed for compliance and regulatory purposes. Once confirmed that the content within these sites is not required you can use either of the following steps.
- Take a backup of the sites if you want to automatically delete unused site collections or delete a site collection if the site collection owner does not respond to multiple email notifications.
- Archive the sites: Archive the content to the central archives and let the archival policy decide the cleanuo of the content.
How to delete a site collection using PowerShell
Remove-SPSite: The PowerShell command completely deletes an existing site collection and all subsites.All content and user information is permanently destroyed as follows when you delete a site collection.
- Site configuration settings.
- Documents and document libraries.
- Subsites: their contentsand user information.
- Role and security information related to the website.
- Lists and itsdataincluding surveys, discussions, events and announcements.
Removal of the association and deletion of the Project Web App before the site collection is deleted is required if the site collection is associated with a Project Server service application. The site collection association with the Project Server service application can be removed from the Project Server service application settings page in the SharePoint Central Administration website.
The example below removes the given site collection and all included sites using GradualDelete and confirmation has been suppressed. The delete operation cannot be undone.
Remove-SPSite: Identity "http://sitename" –GradualDelete –Confirm:$False
Remove-SPWeb: This command is used to completely delete a subsite and can be used instead of deleting the top level Web site of a site collection since it causes the entire site collection to be removed.
Remove-SPWeb http://sitename/subsite
How to delete a site collection from Central Administration
The account that is performing this action must be a member of the Farm Administrators SharePoint group to delete a site collection.
- In the "Site Collections" section, on the "Application Management" page, click "Delete a site collection".
- In the "Site Collection" list, on the "Delete Site Collection" page, click "Change Site Collection".
- Change "Web Application" to the name of the web application that contains the site collection that is to be deleted. The relative URLs of the sites in the site collections of the web application that you have selected will appear in the "Select Site Collection" dialog box.
- Select the relative URL of the site collection that is to be deleted and then click "OK".
- Verify that the site collection information is correct and click "Delete".
How to delete a sub-site using the User Interface
To delete a sub-site, the account that is performing this action must be a member of the Administrators group for that site.
- Click on "Site Actions" | "Site Settings" | "Site Administrator"
Click on the link "Delete this site" as shown in the figure below.
Figure: Site Deletion
- Click Delete then choose "OK" to delete as shown in the figure below.
Figure: Site Deletion Confirmation