Get SharePoint Online Tenant Settings using PowerShell

Requirement: Get tenant settings in SharePoint Online.

PowerShell to Retrieve Tenant Setting in SharePoint Online:

To make the most of the SharePoint Online platform, it’s important to understand the various settings that are available and how they impact the behaviour of SharePoint. 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

Summary

In conclusion, retrieving the tenant settings in SharePoint Online using PowerShell is a straightforward process that can provide valuable insight into the configuration of your SharePoint environment. By following the steps outlined in this guide, you can easily retrieve the tenant settings and gain a deeper understanding of your SharePoint environment. Whether you’re an administrator or a developer, this guide will provide you with the necessary steps to retrieve the tenant settings and ensure that your SharePoint environment is set up to meet your needs.

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!

4 thoughts on “Get SharePoint Online Tenant Settings using PowerShell

  • I am trying to do something in the new PnP module that is dead easy in the old SPO module: report space usage on the tenant:
    Get-SPOGeoStorageQuota | Select TenantStorageMB, GeoUsedStorageMB, GeoAvailableStorageMB
    In theory, Get-PnPTenant should return this information, but I can only return “StorageQuota” which is equivalent to “TenantStorageMB”, but I can’t get actual usage

    Do you know how I can get tenant.TotalSpace, tenant.UsedSpace from the PnP module?

    Reply
  • Hello !!
    Thanks for your article. I have a question about Set-SPOTenant. I would like to disable News Digest on one site of a tenant with this cmd:
    Set-SPOTenant -EnableAutoNewsDigest $false
    Is there a way to target only one site of the tenant and not the whole tenant?
    Thanks!

    Reply
    • This setting applies at the tenant level. But users can opt-out of news digest from the Notification settings from the SharePoint Home site!

      Reply
      • thanks for the fast reply 😀
        ok I see. I’ll disable it anyway 😀

        Reply

Leave a Reply

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