【问题标题】:Sharepoint Online - Site Data Collection changeSharepoint Online - 站点数据收集更改
【发布时间】:2021-01-18 12:07:20
【问题描述】:

我目前正在尝试为我的组织禁用 OneDrive。它适用于新用户,但旧用户可以访问。我制定了一种解决方案 - 当我取消集合管理员权限时,用户无法再使用 OneDrive。

但是我有 1000 个用户,我会手动更改权限,因此有没有脚本可以将所有网站集管理员设置为一个人?

我的意思是那些设置:

https://i.stack.imgur.com/A63RZ.png

【问题讨论】:

    标签: sharepoint


    【解决方案1】:

    如果您想禁用 OneDrive 并且不希望任何人访问它,而不是更改权限,您可以通过 PowerShell 代码锁定所有 OneDrive 站点:

    Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
     
    #Parameters
    $AdminCenterURL = "https://xxx-admin.sharepoint.com"
     
    Try {
        #Connect to SharePoint Online Admin Center
        Connect-SPOService -Url $AdminCenterURL -Credential (Get-Credential)
     
        #Get All OneDrive for Business Sites in the Tenant
        $OneDriveSites = Get-SPOSite -Limit ALL -includepersonalsite $True -Filter "Url -like '-my.sharepoint.com/personal/'"
          
        #Loop through each OneDrive Site
        Foreach($Site in $OneDriveSites)
        {
            Set-SPOSite -Identity $Site -LockState "NoAccess"
            Write-host "Scanning site:"$Site.Url "is locked"-f Yellow
     
        }
    }
    Catch {
        write-host -f Red "Error locking Sites:" $_.Exception.Message
    }
    

    结果是:

    之后,当用户尝试访问 OneDrive 时,会返回 403 错误。

    关于Set-SPOSite

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-07-02
      • 2018-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多