Get SharePoint Online Tenant Settings using PowerShell

Requirement: Get tenant settings in SharePoint Online

PowerShell to Retrieve Tenant Setting in SharePoint Online:
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:
#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 *
Get SharePoint Online Tenant Settings using PowerShell Get SharePoint Online Tenant Settings using PowerShell Reviewed by Salaudeen Rajack on September 16, 2018 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.