Get SharePoint Online Tenant Settings using PowerShell

Requirement: Get tenant settings in SharePoint Online

PowerShell to Retrieve Tenant Setting in SharePoint Online:

In this blog post, we are going to show you how to use PowerShell to get tenant settings for SharePoint Online. This can be useful for troubleshooting issues or for gathering information about the settings that are configured for your tenant. With PowerShell, you will be able to quickly and easily get the information that you need.

Use Get-SPOTenant cmdlet to get all configuration settings of the tenant.

#Set SharePoint Online Admin Center URL

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

#Get Tenant Settings

This cmdlet gets all settings of the tenant

Get SharePoint Online Tenant Settings using PowerShell

Get SharePoint Online Tenant Settings using PowerShell

We can also use CSOM PowerShell to retrieve tenant settings in SharePoint Online:

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\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 = ""

#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)

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

PnP PowerShell to retrieve Tenant Settings

$AdminCenterURL = ""
#Connect to PnP
Connect-PnPOnline -Url $AdminCenterURL -Interactive

#Get Tenant Settings

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

Leave a Reply

Your email address will not be published. Required fields are marked *