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

[玩转系统] 使用 PowerShell 获取 SharePoint Online 租户设置

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

使用 PowerShell 获取 SharePoint Online 租户设置


要求:获取 SharePoint Online 中的租户设置。

PowerShell 用于检索 SharePoint Online 中的租户设置:

为了充分利用 SharePoint Online 平台,了解可用的各种设置以及它们如何影响 SharePoint 的行为非常重要。在这篇博文中,我们将向您展示如何使用 PowerShell 获取 SharePoint Online 的租户设置。这对于解决问题或收集有关为租户配置的设置的信息非常有用。使用 PowerShell,您将能够快速轻松地获取所需的信息。

使用 Get-SPOTenant cmdlet 获取租户的所有配置设置。


#Set SharePoint Online Admin Center URL
$AdminSiteURL="https://crescent-admin.sharepoint.com"

#Connect to SharePoint Online Admin Center
Connect-SPOService -Url $AdminSiteURL -Credential (Get-Credential)

#Get Tenant Settings
Get-SPOTenant

此 cmdlet 获取租户的所有设置

[玩转系统] 使用 PowerShell 获取 SharePoint Online 租户设置

使用 PowerShell 获取 SharePoint Online 租户设置

我们还可以使用 CSOM PowerShell 检索 SharePoint Online 中的租户设置:


#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
Add-Type -Path "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.Online.SharePoint.Client.Tenant.dll"

#Set Tenant Admin parameters
$AdminSiteURL = "https://crescent-admin.sharepoint.com"

#Get Credentials to connect
$Cred= Get-Credential

#Setup the context
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($AdminSiteURL)
$Context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)

#Create tenant object and get tenant settings
$Tenant = New-Object Microsoft.Online.SharePoint.TenantAdministration.Tenant($Context)
$Context.Load($Tenant)
$Context.ExecuteQuery()

#Get All Properties of the Tenant
$Tenant | Select *

用于检索租户设置的 PnP PowerShell


#Parameters
$AdminCenterURL = "https://Crescent-admin.sharepoint.com"
 
#Connect to PnP
Connect-PnPOnline -Url $AdminCenterURL -Interactive

#Get Tenant Settings
Get-PnPTenant

概括

总之,使用 PowerShell 检索 SharePoint Online 中的租户设置是一个简单的过程,可以提供有关 SharePoint 环境配置的宝贵见解。通过遵循本指南中概述的步骤,您可以轻松检索租户设置并更深入地了解您的 SharePoint 环境。无论您是管理员还是开发人员,本指南都将为您提供检索租户设置并确保您的 SharePoint 环境设置满足您的需求所需的步骤。

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

取消回复欢迎 发表评论:

关灯