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

[玩转系统] SharePoint Online:用于获取外部共享设置的 PowerShell

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

SharePoint Online:用于获取外部共享设置的 PowerShell


要求:查找所有启用(或禁用!)外部共享的网站集。

如何检查 SharePoint Online 网站是否启用了外部共享?

作为管理员,您可能需要审核特定站点(或所有站点!)的外部共享设置。此博文将向您展示如何从管理中心获取 SharePoint Online 中的外部共享设置。此外,我们还将了解如何使用 PowerShell 获取 SharePoint Online 网站的外部共享设置。

要检查网站集的外部共享设置,请执行以下步骤:

  1. 登录 SharePoint Online 管理中心 >> 单击左侧导航中的“站点”链接。
  2. 从站点列表中选择站点,然后单击工具栏中的“共享”按钮。共享页面显示当前站点的外部共享设置。

    [玩转系统] SharePoint Online:用于获取外部共享设置的 PowerShell

这些设置表示以下内容:

  1. 任何人 - 启用外部用户共享(通过电子邮件共享)和访客链接共享
  2. 新用户和现有用户 - 启用外部用户共享(通过电子邮件共享),但禁用访客链接共享
  3. 现有外部用户 - 仅允许与组织目录中已存在的外部用户共享(默认设置)
  4. 仅限当前组织中的人员 - 外部用户共享(通过电子邮件共享)和访客链接共享 - 两者均已禁用

PowerShell 在 SharePoint Online 中获取外部共享配置:

SharePoint Online 中的外部共享(或来宾共享)功能使用户能够与组织外部的非成员(例如外部供应商、客户、顾问等)共享文档和内容。

SharePoint Online:用于列出外部共享的 PowerShell

虽然可以使用本文底部提供的链接配置租户级别的外部共享设置,但我们可以使用 SharePoint Online Management Shell 中的此 PowerShell 脚本检查所有网站集级别的外部共享设置:


#Config Variables
$AdminSiteURL= "https://crescent-admin.sharepoint.com"

#Connect to SharePoint Online services
Connect-SPOService -url $AdminSiteURL -Credential (Get-Credential)

#Get External Sharing Settings for all sites
Get-SPOSite | Select-object url,sharingcapability

同样,我们可以获得所有启用外部共享的网站集,如下所示:


#Get All Site Collections with External Sharing Enabled
$Sites = Get-SPOSite -IncludePersonalSite $False | where {$_.SharingCapability -ne "Disabled"} 

#Get URL of each site
Foreach ($Site in $Sites)
{
   Write-Host $Site.Url
}

PnP PowerShell 检查所有网站集的外部共享设置

让我们获取租户中所有站点的外部共享设置并将其导出到 CSV 文件。


#Parameters
$Domain =  "crescentintranet" #Domain Name in SharePoint Online. E.g. https://Crescent.sharepoint.com
$CSVFile = "C:\Temp\ExternalSharing.csv"

#Frame Tenant URL and Tenant Admin URL
$TenantURL = "https://$Domain.SharePoint.com"
$TenantAdminURL = "https://$Domain-Admin.SharePoint.com"

#Connect to Admin Center
Connect-PnPOnline -Url $TenantAdminURL -Interactive

#Get All Site collections - Filter BOT and MySite Host
$Sites = Get-PnPTenantSite -Filter "Url -like '$TenantURL'"

#Export External Sharing settings to CSV
$Sites | Select URL, SharingCapability
$Sites | Select URL, SharingCapability | Export-CSV $CSVFile -NoTypeInformation

相关文章:

  • SharePoint Online:使用 PowerShell 禁用外部共享
  • SharePoint Online:使用 PowerShell 启用外部共享
  • SharePoint Online:使用 PowerShell 与外部用户共享

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

取消回复欢迎 发表评论:

关灯