Set-PnPAuditing

Set Auditing setting for a site

Syntax

Set-PnPAuditing
   [-RetentionTime <Int>]
                  [-TrimAuditLog [<SwitchParameter>]]
                  [-EditItems [<SwitchParameter>]]
                  [-CheckOutCheckInItems [<SwitchParameter>]]
                  [-MoveCopyItems [<SwitchParameter>]]
                  [-DeleteRestoreItems [<SwitchParameter>]]
                  [-EditContentTypesColumns [<SwitchParameter>]]
                  [-SearchContent [<SwitchParameter>]]
                  [-EditUsersPermissions [<SwitchParameter>]]
                  [-Connection <SPOnlineConnection>]
Set-PnPAuditing
   -EnableAll [<SwitchParameter>]
                  [-RetentionTime <Int>]
                  [-TrimAuditLog [<SwitchParameter>]]
                  [-Connection <SPOnlineConnection>]
Set-PnPAuditing
   -DisableAll [<SwitchParameter>]
                  [-Connection <SPOnlineConnection>]

Examples

------------------EXAMPLE 1------------------

Set-PnPAuditing -EnableAll

Enables all auditing settings for the current site

------------------EXAMPLE 2------------------

Set-PnPAuditing -DisableAll

Disables all auditing settings for the current site

------------------EXAMPLE 3------------------

Set-PnPAuditing -RetentionTime 7

Sets the audit log trimming to 7 days, this also enables the automatic trimming of the audit log

------------------EXAMPLE 4------------------

Set-PnPAuditing -TrimAuditLog

Enables the automatic trimming of the audit log

------------------EXAMPLE 5------------------

Set-PnPAuditing -RetentionTime 7 -CheckOutCheckInItems -MoveCopyItems -SearchContent

Sets the audit log trimming to 7 days, this also enables the automatic trimming of the audit log.

Do auditing for:

  • Checking out or checking in items
  • Moving or copying items to another location in the site
  • Searching site content

Parameters

-CheckOutCheckInItems

Audit checking out or checking in items

Type:SwitchParameter
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Connection

Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

Type:SPOnlineConnection
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-DeleteRestoreItems

Audit deleting or restoring items

Type:SwitchParameter
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-DisableAll

Disable all audit flags

Type:SwitchParameter
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-EditContentTypesColumns

Audit editing content types and columns

Type:SwitchParameter
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-EditItems

Audit editing items

Type:SwitchParameter
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-EditUsersPermissions

Audit editing users and permissions

Type:SwitchParameter
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-EnableAll

Enable all audit flags

Type:SwitchParameter
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-MoveCopyItems

Audit moving or copying items to another location in the site.

Type:SwitchParameter
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-RetentionTime

Set the retention time

Type:Int
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-SearchContent

Audit searching site content

Type:SwitchParameter
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-TrimAuditLog

Trim the audit log

Type:SwitchParameter
Position:Named
Accept pipeline input:False
Accept wildcard characters:False