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
$AdminSiteURL="https://crescent-admin.sharepoint.com"

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

#Get Tenant Settings
Get-SPOTenant

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 = "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 to retrieve Tenant Settings

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

#Get Tenant Settings
Get-PnPTenant

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 *