Recently, one of my clients asked me to get the creation date of a SharePoint Online site. I used PnP PowerShell for this, which is easy to use and to work with SharePoint sites. In this tutorial, I will show you how to get SharePoint site creation date using PnP PowerShell.
Get SharePoint Site Creation Date using PnP PowerShell
If you have access to the SharePoint Online admin center, then you can check the creation date of the SharePoint site from the Active Sites tab.
Otherwise, PnP PowerShell is another best option to get the SharePoint site creation date.
Here is the complete PowerShell script.
# Define the site collection URL
$siteUrl = "https://szg52.sharepoint.com/sites/PowerShellFAQs"
# Connect to SharePoint Online
Connect-PnPOnline -Url $siteUrl -Interactive
# Retrieve the root web of the site collection
$web = Get-PnPWeb -Includes Created
# Retrieve the site collection creation date
$creationDate = $web.Created
# Display the creation date
Write-Host "The site collection was created on:" $creationDateI executed the above PnP PowerShell script using VS code; you can see here it displays the creation of the SharePoint Online site.

Here, I have used the Get-PnPWeb PnP PowerShell cmdlet with the -Includes Created parameter to get the creation date of the root web.
If you want to reuse the code, then you can create a function like below:
function Get-SPOCreationDate {
param (
[Parameter(Mandatory=$true)]
[string]$SiteUrl
)
try {
# Connect to SharePoint Online
Connect-PnPOnline -Url $SiteUrl -Interactive
# Retrieve the root web of the site collection
$web = Get-PnPWeb -Includes Created
# Retrieve the site collection creation date
$creationDate = $web.Created
# Display the creation date
Write-Host "The site collection was created on:" $creationDate
}
catch {
Write-Host "An error occurred:" $_.Exception.Message
}
}
# Example Usage
$siteUrl = "https://szg52.sharepoint.com/sites/PowerShellFAQs"
Get-SPOCreationDate -SiteUrl $siteUrlEvery time the user passes the SharePoint site URL, the site creation date will be displayed.
I hope this tutorial helps you and you got to know now how to get the SharePoint Online site creation date using PnP PowerShell. Still have questions, feel free to leave a comment below.
You may like the following tutorials:
- Enable Custom Script in SharePoint Online Using PnP PowerShell
- Delete and Recover a SharePoint Online Site Using PowerShell and PnP PowerShell
- How to Get SharePoint Site ID using PnP PowerShell?
Bijay Kumar is an esteemed author and the mind behind PowerShellFAQs.com, where he shares his extensive knowledge and expertise in PowerShell, with a particular focus on SharePoint projects. Recognized for his contributions to the tech community, Bijay has been honored with the prestigious Microsoft MVP award. With over 15 years of experience in the software industry, he has a rich professional background, having worked with industry giants such as HP and TCS. His insights and guidance have made him a respected figure in the world of software development and administration. Read more.