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

[玩转系统] 使用 PowerShell 配置 SharePoint 2013/2016 网站的审核设置

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

使用 PowerShell 配置 SharePoint 2013/2016 网站的审核设置


SharePoint 中的审核日志功能帮助我们分析用户如何使用 SharePoint 内容或根据合规性要求跟踪文档和用户。 SharePoint 2013 审核日志配置在另一篇文章中进行了解释:在 SharePoint 2013 中配置审核日志功能。让我们看看如何使用 PowerShell 在 SharePoint 2013 中启用审核功能。

用于设置 SharePoint 2016 审核日志设置的 PowerShell

要使用 PowerShell 设置 SharePoint 2013 网站集审核设置,请使用以下脚本:


Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue

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

#Get the site collection
$Site = Get-SPSite $SiteCollURL

#Define Audit Events
$AuditLogEvents = "Delete", "Update" 

$Site.Audit.AuditFlags = $AuditLogEvents
$Site.Audit.Update()

#Set Trimming Options
$Site.TrimAuditLog = $true
$Site.AuditLogTrimmingRetention = 10

为 SharePoint 2013 中的所有网站配置审核日志设置


$WebApp = Get-SPWebApplication "https://sharepoint.company.com"
$AuditMask = [Microsoft.SharePoint.SPAuditMaskType]::Delete -bxor [Microsoft.SharePoint.SPAuditMaskType]::Update -bxor [Microsoft.SharePoint.SPAuditMaskType]::SecurityChange

$WebApp.sites | % {

$_.TrimAuditLog = $true
$_.Audit.AuditFlags = $auditmask
$_.Audit.Update()
$_.AuditLogTrimmingRetention = 30
}

有关所有可用的审核掩码,请参阅 MSDN:https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spauditmasktype.aspx

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

取消回复欢迎 发表评论:

关灯