Skip to content

Set-TenantSyncClientRestriction

SharePoint Online: Sets sync client restrictions

#Requires -Version 5.1
#Requires -Modules Microsoft.Online.SharePoint.PowerShell

[CmdletBinding(DefaultParameterSetName = 'FileExclusion')]
Param(
    [Parameter(Mandatory = $true, ParameterSetName = 'FileExclusion')]
    [string]$ExcludedFileExtensions,
    [Parameter(Mandatory = $true, ParameterSetName = 'Blocking')]
    [string]$DomainGuids,
    [Parameter(Mandatory = $true, ParameterSetName = 'GrooveBlock')]
    [ValidateSet('OptOut','HardOptin','SoftOptin')]
    [string]$GrooveBlockOption,
    [Parameter(Mandatory = $true, ParameterSetName = 'ReportProblem')]
    [bool]$DisableReportProblemDialog,
    [Parameter(ParameterSetName = 'Blocking')]
    [switch]$BlockMacSync,
    [Parameter(ParameterSetName = 'Blocking')]
    [switch]$Enable
)

Process {
    try {
        $cmdArgs = @{ ErrorAction = 'Stop' }
        if ($PSCmdlet.ParameterSetName -eq 'FileExclusion') { $cmdArgs.Add('ExcludedFileExtensions', $ExcludedFileExtensions) }
        elseif ($PSCmdlet.ParameterSetName -eq 'Blocking') {
            $cmdArgs.Add('BlockMacSync', $BlockMacSync)
            $cmdArgs.Add('Enable', $Enable)
            $guids = $DomainGuids.Split(',')
            $cmdArgs.Add('DomainGuids', $guids)
        }
        elseif ($PSCmdlet.ParameterSetName -eq 'GrooveBlock') { $cmdArgs.Add('GrooveBlockOption', $GrooveBlockOption) }
        elseif ($PSCmdlet.ParameterSetName -eq 'ReportProblem') { $cmdArgs.Add('DisableReportProblemDialog', $DisableReportProblemDialog) }
        $result = Set-SPOTenantSyncClientRestriction @cmdArgs | Select-Object *
        if ($null -ne $result) { foreach ($item in $result) { $item | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format "yyyy-MM-dd HH:mm:ss") -PassThru -Force } }
    }
    catch { throw }
}

Blocks certain file types from syncing

Comma-separated domain GUIDs for safe recipient list

Controls old OneDrive sync client usage

Disable report problem dialog

Off

Block Mac sync clients

Off

Enable the sync restriction feature

An interactive directory of PowerShell scripts.