Site Use Confirmation and Deletion in SharePoint 2013

Site use confirmation and deletion feature in SharePoint helps to keep your content up to date by removing unused site collection automatically. To manage this feature, head on to:

  •  SharePoint 2013 Central Administration site
  • Application Management >> Click on the “Confirm Site use and deletion” link.
confirm site use and deletion

In the Site use confirmation and deletion page, we set options:

  • To enable or disable this feature, Set the check-box for “Automatically delete the site collection if use is not confirmed”
  •  Configure E-mail notification settings such as the number of days to wait, Notification interval and time preferences.

sharepoint 2013 site use confirmation and deletion
SharePoint site use confirmation and deletion scoped at the web application level. So all site collections under the specific web application will abide by this setting.

Here is an Email sent to site collection administrators for site use confirmation. They can simply visit the link provided to confirm a particular site collection.

sharepoint site use confirmation and deletion

Configure SharePoint site use confirmation deletion using PowerShell:
Use this PowerShell script to manage site use confirmation and deletion.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Get the web app
$WebApp= Get-SPWebApplication -Identity "https://intranet.crescent.com" 

#Enable Notifications for unused site collections
$WebApp.SendUnusedSiteCollectionNotifications=$true
#Interval 
$WebApp.UnusedSiteNotificationPeriod = "45" 

#Enable automatic deletion of site collections
$WebApp.AutomaticallyDeleteUnusedSiteCollections = $true
#Number of Notifications to send before deletion
$WebApp.UnusedSiteNotificationsBeforeDeletion = "30" 

$WebApp.Update()

We can also set the timer job, which runs to perform this operation by:

#Configure "Dead Site Delete" Timer job 
$TimerJob = Get-SPTimerJob -WebApplication $WebApp | ?{$_.Title -eq "Dead Site Delete" } 
$TimerJob | Set-SPTimerJob -Schedule "Daily at 12:00"

Run SharePoint Timer job on-demand:
To Run this Timer job, On-Demand, use

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$WebAppURL="https://intranet.crescent.com" 

#Get the web app
$WebApp= Get-SPWebApplication -Identity $WebAppURL

$TimerJob = Get-SPTimerJob -WebApplication $WebApp | ?{$_.Title -eq "Dead Site Delete" } 

Start-SPTimerJob $TimerJob

Query Site use confirmation on site collections:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$WebAppURL="https://intranet.crescent.com" 

#Get the web app
$WebApp= Get-SPWebApplication -Identity $WebAppURL

#Get All Site Collections
$Sites = $WebApp | Get-SPSite -limit All 

#Query last Confirmed date of each site
$Sites | ForEach-Object { write-host $_.URL last confirmed on: $_.CertificationDate ,Number of notification sent: $_.DeadWebNotificationCount }

This gives you the last site use confirmed date and number of notifications sent.

Confirm site use using PowerShell:
When you turned ON Site use confirmation and Deletion for a web application, it applies to All site collections in that web application. Sometimes, you may have to exclude certain sites E.g. Top level site collection or sites under a particular managed path. Well, There isn’t any direct way to exclude sites from automatic notification and deletion in central admin or somewhere else, but you can use this workaround of running below script on scheduled basis.

Lets say, You want to reset site use confirmation for all site collections under a specific managed path. You can do it with PowerShell by calling ConfirmUsage method of SPSite object. Here is the script to reset site use confirmation.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$WebAppURL="https://intranet.crescent.com" 
$ManagedPath="projects"

#Get the web app
$WebApp= Get-SPWebApplication -Identity $WebAppURL

#get all site collections under a managed path 
$Sites = Get-SPSite "$($WebAppURL)/$($ManagedPath)/*" -Limit ALL 

#Confirm each site usage
$Sites | ForEach-Object {$_.ConfirmUsage()}

Once you confirm, it resets “DeadWebNotificationCount” property to 0.

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

4 thoughts on “Site Use Confirmation and Deletion in SharePoint 2013

  • Hi.. how can I get site collections which are not accessed / browsed ( instead of last update ) using powershell instead of configuring it from Central Admin and sending email

    Reply
  • Do we have this same feature for Sites and sub-sites. I have only one site collection which has 2000+ sites and I want to cleanup now. what to do, please suggest Rajack.

    Reply
    • Site usage confirmation is applicable only to Site collections. You can use SPWeb.LastContentModifiedDate to get the active/inactive sub-sites.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *