当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] SharePoint 2013 中的网站使用确认和删除

作者:精品下载站 日期:2024-12-14 13:41:32 浏览:15 分类:玩电脑

SharePoint 2013 中的网站使用确认和删除


SharePoint 中的网站使用确认和删除功能可通过自动删除未使用的网站集来帮助您保持内容最新。要管理此功能,请前往:

  • SharePoint 2013 管理中心网站
  • 应用程序管理 >> 单击“确认网站使用和删除”链接。

[玩转系统] SharePoint 2013 中的网站使用确认和删除

在站点使用确认和删除页面中,我们设置选项:

  • 要启用或禁用此功能,请设置“如果未确认使用则自动删除网站集”复选框
  • 配置电子邮件通知设置,例如等待天数、通知间隔和时间首选项。

[玩转系统] SharePoint 2013 中的网站使用确认和删除

这是发送给网站集管理员以确认网站使用的电子邮件。他们只需访问所提供的链接即可确认特定网站集。

[玩转系统] SharePoint 2013 中的网站使用确认和删除

使用 PowerShell 配置 SharePoint 网站使用确认删除:
使用此 PowerShell 脚本来管理网站使用确认和删除。


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

我们还可以设置计时器作业,该作业通过以下方式运行来执行此操作:


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

按需运行 SharePoint 计时器作业:
要按需运行此计时器作业,请使用


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

在网站集上查询网站使用确认:


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 }

这将为您提供最后一次网站使用确认日期和发送的通知数量。

使用 PowerShell 确认网站使用:
当您为 Web 应用程序启用网站使用确认和删除时,它适用于该 Web 应用程序中的所有网站集。有时,您可能必须排除某些网站,例如顶级网站集或特定托管路径下的网站。好吧,没有任何直接的方法可以在中央管理或其他地方将网站从自动通知和删除中排除,但您可以使用按计划运行以下脚本的解决方法。

比方说,您想要重置特定托管路径下所有网站集的网站使用确认。您可以使用 PowerShell 通过调用 SPSite 对象的ConfirmUsage方法来完成此操作。这是重置站点使用确认的脚本。


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

确认后,它将“DeadWebNotificationCount”属性重置为 0。

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯