SharePoint Online: Get Site Collection Created Date using PowerShell

Requirement: Get the Site Collection creation date in SharePoint Online.

How to Check SharePoint Online Site Creation Date?

If you are looking for a way to get the creation date of a site collection in SharePoint Online, PowerShell is your best bet. This can be useful for reporting or auditing purposes. In this blog post, we will be looking at how you can get the site collection created date in SharePoint Online. Let’s walk through the steps necessary to get the creation date!

To get the creation date of a SharePoint Online site collection, do the following:

  1. Login to SharePoint Admin center >> Expand Sites >> Active Sites.
  2. Now the sites list shows the creation date of the sites in the “Date Created” column (Add it to the view, if it’s not there already!)
    sharepoint online powershell get site collection created date

SharePoint Online: PowerShell to Get Site Creation Date

PowerShell can help to find the SharePoint Online site collection created date:

#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 parameter values

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

        #sharepoint online powershell get site creation date
        Write-host -f Green "Site Collection Created Date:"$Web.created.toShortDateString()
    Catch {
        write-host -f Red "Error Getting Site Collection Creation Date!" $_.Exception.Message

This PowerShell gets the site collection creation date!

Get Created Date of All SharePoint Online Site Collections in Office 365 Tenant:

Let’s get created date of all site collections in the tenant.

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.Runtime.dll"

#Config Parameters
Try {
    #Get Credentials to connect
    $Cred = Get-Credential
    $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
    #Connect to SharePoint Online Admin Center
    Connect-SPOService -Url $AdminSiteURL -Credential $Cred
    #Get All site collections
    $SiteCollections = Get-SPOSite -Limit All
    Write-Host "Total Number of Site collections Found:"$SiteCollections.count -f Yellow
    #Array to store Result
    $ResultSet = @()
    #Loop through each site collection and retrieve details
    Foreach ($Site in $SiteCollections)
        Write-Host "Processing Site Collection :"$Site.URL -f Yellow
        Try {
            #Get the Root web of the Site collection
            $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($Site.URL)
            $Ctx.Credentials = $Credentials  
            $CreatedDate = $RootWeb.created.toShortDateString()
        Catch {    
            write-host -f Red "`tError Getting Root Web:" $_.Exception.Message

        #Get site collection details    
        $Result = new-object PSObject
        $Result | add-member -membertype NoteProperty -name "Title" -Value $Site.Title
        $Result | add-member -membertype NoteProperty -name "Url" -Value $Site.Url
        $Result | add-member -membertype NoteProperty -name "CreatedDate" -Value ($CreatedDate)
        $ResultSet += $Result
    #Export Result to csv file
    $ResultSet |  Export-Csv $ReportOutput -notypeinformation  
    Write-Host "Site Creation Date Report Generated Successfully!" -f Green
Catch {    
    write-host -f Red "Error:" $_.Exception.Message

PnP PowerShell to Get Site Collection Created Date in SharePoint Online:

Getting the creation date of a site collection in SharePoint Online with PnP PowerShell is pretty easy!

#Config Variable
$SiteURL = ""

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

#Get the Root Web with "created" property
$Web = Get-PnPWeb -Includes Created

#Get Site Collection Created Date
Write-host "Site Collection Created on:"$Web.Created 

Let’s get all Site collections sort by created date:

$TenantURL =  ""
#Get Credentials to connect
$Credential = Get-Credential
#Frame Tenant Admin URL from Tenant URL
$TenantAdminURL = $TenantURL.Insert($TenantURL.IndexOf("."),"-admin")

#Connect to Admin Center
Connect-PnPOnline -Url $TenantAdminURL -Credentials $Credential
#Get All Site collections - Filter BOT and MySite Host
$Sites = Get-PnPTenantSite -Filter "Url -like '$TenantURL'"

#Iterate through all sites
$SiteInventory = @()
$Sites | ForEach-Object {
    #Connect to each site collection
    Connect-PnPOnline -Url $_.URL -Credentials $Credential

    #Get the Root Web with "created" property
    $Web = Get-PnPWeb -Includes Created

    #Collect Data
    $SiteInventory += New-Object PSObject -Property  ([Ordered]@{
        "Site Name"  = $Web.Title
        "URL "= $Web.URL
        "Created Date" = $Web.Created
#Sort Site Collection - Sort by Creation Date
$SiteInventory | Sort-Object 'Created Date' -Descending

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!

13 thoughts on “SharePoint Online: Get Site Collection Created Date using PowerShell

  • Hi,
    I’m facing an issue with the $Web = Get-PnPWeb -Includes Created
    Even if I run the script with the account that has SP admin role assigned, I get the following error:
    Get-PnPWeb : The remote server returned an error: (403) Forbidden.

    This only works if I add that account as site collection admin. Then the “$Web = Get-PnPWeb -Includes Created” runs ok. But adding site collection admin to each site and then remove it, it significantly slows down the script when processing 8000 sites on daily basis.

    Any solution to this?

    • Some properties like Site Owner, Site Created date can be retrieved only when you have site collection admin rights to the site. I’d suggest to either add your SharePoint Admin account to all SharePoint Online sites as site collection administrator or Use the Azure AD App ID method.

      • Hi,
        thanks for the reply. I tried Connect-PNPOnline with the AAD App (permissions granted: Sites.FullControl.All), and authenticate with Certificate but the result was the same, with the same error message when calling Get-PnPWeb. Not sure if there is anything else I missed. For now, I will stick to assigning site collection admin to each site collection on every script run.

  • Is there any way to change the time zone? In the date created column the time appears to be from a US time zone.

  • Does it need admin access to the site?
    In your articles, can you please mention whenever site admin access is needed. It would be very helpful. Thanks.

  • How would you get all the SPOsites created within the last month?

    • Just use: $SiteInventory | Where {$_.’Created Date’ -gt [DateTime]::Today.AddDays(-30)}

  • Hello! I see that some of your scripts “Filter BOT and MySite Host”, which leads me to believe that you may know more about the purpose of the BOT sites. For example, when I run the command Get-SPOSite I have a site that looks like this example: “https://bot19###-002/sites/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

    I’ve had a ticket open with Microsoft for a couple of weeks and I’m not getting any answers! Thanks for any assistance.

  • Hi, is there a way to capture the created date of a subsite too?

    • Yes, the script actually gets the created date of the “Root Web”, So just enter the $SiteURL variable value to a Subsite URL!

  • How can you capture this for all site collections?


Leave a Reply

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