SharePoint Online: Get Site Title using PowerShell

Requirement: Get SharePoint Online site title using PowerShell.

How to Get the Site Name in SharePoint Online?

You may need to quickly reference the title of a site in your reports generated from SharePoint Online sites. In this blog post, I’ll show you how to use PowerShell to get the title of a SharePoint Online site.

To get the site name or site title, Just login to the site >> Click on Settings Gear >> Choose “Site Information” >> And you’ll find the site title!

Get Site Title in SharePoint Online using PowerShell

SharePoint Online: Get Site Title using PowerShell

Let’s use the PowerShell script to get the site title in SharePoint Online.

$AdminSiteURL = ""
$SiteURL = ""

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

#Get the Site Collection
$Site = Get-SPOSite -Identity $SiteURL

#Get Site Collection Title
Write-host $Site.Title

PowerShell to Get Site Collection Title

We can also use this CSOM PowerShell script at the site level to get the site name.

#Import PoweShell Module for SharePoint Online
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking

$SiteUrl = ""

#Get Credentials to connect
$Cred = Get-Credential

Try {
    #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 the site title
    Write-host -f Green "Site Title:" $Web.Title
catch {
    write-host "Error Getting Site Title: $($_.Exception.Message)" -foregroundcolor Red

Retrieve SharePoint Online Site Title using PnP PowerShell

If you are looking for a way to get your site title in SharePoint Online using PnP PowerShell, Here you go:

$SiteURL= ""

#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive #-Credential (Get-Credential)

#Get the Root Web
$Web = Get-PnPWeb

#Get the Site Title
Write-host -f Green $Web.Title

In summary, retrieving the site name in SharePoint Online using PowerShell is a straightforward task that can be done with a few lines of script. By using PowerShell, SharePoint administrators can automate many tasks, including retrieving site information. The script provided in this article is a simple example of how to retrieve the site name, and it can be adapted to fit other needs.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

Leave a Reply

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