Thursday, December 5, 2013

Site Use Confirmation and Deletion in SharePoint 2013

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

  •  SharePoint 2013 Central Administration site 
  • Application Management >> Click on "Confirm Site use and deletion" link.
site use confirmation and deletion sharepoint 2013
In 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 number of days to wait, Notification interval and time preferences.

SharePoint site use confirmation and deletion scoped at 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.
site use confirmation and automatic deletion sharepoint 2010

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 "http://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 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 onDemand:
To Run this Timer job , OnDemand, use
Add-PSSnapin Microsoft.SharePoint.PowerShell –ErrorAction SilentlyContinue

$WebAppURL="http://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="http://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 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="http://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.



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...