SharePoint Online: Get Site Properties using PowerShell

Requirement: Get site properties in SharePoint Online using PowerShell

SharePoint Online: PowerShell to Get Site Properties

This quick PowerShell guide will show you how to get site properties for a SharePoint Online site. This script can be helpful when diagnosing issues with a site or gathering information for reporting purposes. Let’s walk through the steps necessary to obtain site settings using PowerShell!

You can get SharePoint Online site properties using SharePoint Management Shell cmdlet Get-SPOSite

#Set Parameters

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

#Get site properties
Get-SPOSite $SiteURL | Select *

This PowerShell gets all properties of the site. Please note, the “-Detailed” switch is deprecated now.

sharepoint online powershell get site properties

SharePoint Online: PowerShell to Get Web Properties

Say you want to get the last modified date of a SharePoint Online site using PowerShell, Here is the CSOM way to get site properties:

#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"
#Set Parameters
$SiteURL= ""

#Get Credentials to connect
$Cred = Get-Credential

#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
#Get the web
$Web = $Ctx.web

#Get Properties of the Web
$SiteProperties = New-Object PSOBject
$SiteProperties | Add-Member NoteProperty Title($Web.Title)
$SiteProperties | Add-Member NoteProperty Url($Web.Url)
$SiteProperties | Add-Member NoteProperty ServerRelativeUrl($Web.ServerRelativeUrl)
$SiteProperties | Add-Member NoteProperty Description($Web.Description)
$SiteProperties | Add-Member NoteProperty Created($Web.Created)
$SiteProperties | Add-Member NoteProperty LastModified($Web.LastItemModifiedDate)
$SiteProperties | Add-Member NoteProperty AllowRSSFeeds($Web.AllowRssFeeds)
$SiteProperties | Add-Member NoteProperty CustomMasterUrl($Web.CustomMasterUrl)
$SiteProperties | Add-Member NoteProperty EnableMinimalDownload($Web.EnableMinimalDownload)
$SiteProperties | Add-Member NoteProperty ID($Web.Id)
$SiteProperties | Add-Member NoteProperty Language($Web.Language)
$SiteProperties | Add-Member NoteProperty MasterUrl($Web.MasterUrl)
$SiteProperties | Add-Member NoteProperty QuickLaunchEnabled($Web.QuickLaunchEnabled)
$SiteProperties | Add-Member NoteProperty RecycleBinEnabled($Web.RecycleBinEnabled)
$SiteProperties | Add-Member NoteProperty TreeViewEnabled($Web.TreeViewEnabled)
$SiteProperties | Add-Member NoteProperty UIVersion($Web.UIVersion)
$SiteProperties | Add-Member NoteProperty WebTemplate($Web.WebTemplate)
$SiteProperties | Add-Member NoteProperty ExcludeFromSearch($Web.NoCrawl)


PnP PowerShell to Get Site Detailed Info in SharePoint Online

Here is how to use PnP PowerShell to get site settings in SharePoint Online:

$AdminCenterURL = ""
$SiteURL = ""

#Connect to Admin Center
Connect-PnPOnline -Url $AdminCenterURL -Interactive
#Get the Site's detailed info
Get-PnPTenantSite -Identity $SiteURL | Select -Property *

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply