All Sites Report In SharePoint Online

If you are a SharePoint Online admin, it’s very important for you to know what is going on in your SharePoint Tenant.

One option to do that is to log into the SharePoint Online Admin Center and view the Site Collections list. It has its own pros and cons. For example, to get the list of all modern sites, you need to click on the New Admin Center Preview.

Hence, it’s always handy to have a quick script which can give you some important information about all the site collections in your SharePoint Online Tenant without logging into the Admin Center.

To run this command, you need to be a SharePoint Online admin and you should have PnP PowerShell module installed on your client machine.

If you need to know how to install PnP PowerShell, visit this link.

To get the report, follow the below steps.

  1. Launch PowerShell Window on the client machine.
  2. Connect to SharePoint Online Admin Center using the below PowerShell command.

    $cred = Get-Credential
    Connect-PnPOnline "https://yourtenantname-admin.sharepoint.com" -Credentials $cred
  1. Get the list of all the collections.

    $SiteCollectionsList = Get-PnPTenantSite
  1. Export the site collection list to a CSV file.

    $SiteCollectionsList| select URL, Title, LastContentModifiedDate, WebsCount, Template, StorageUsage | Export-Csv -Path "c:\SiteCollectionsList.csv"

This will create a CSV file on the specified path.

You can choose from the following properties and update the select command in step four. 

A list of available properties is given below.

  • AllowDownloadingNonWebViewableFiles
  • AllowEditing
  • AllowSelfServiceUpgrade
  • AverageResourceUsage
  • CommentsOnSitePagesDisabled
  • CompatibilityLevel
  • ConditionalAccessPolicy
  • CurrentResourceUsage
  • DefaultLinkPermission
  • DefaultSharingLinkType
  • DenyAddAndCustomizePages
  • DisableAppViews
  • DisableCompanyWideSharingLinks
  • DisableFlows
  • HasHolds
  • HubSiteId
  • IsHubSite
  • LastContentModifiedDate
  • Lcid
  • LimitedAccessFileType
  • LockIssue
  • LockState
  • NewUrl
  • Owner
  • OwnerEmail
  • OwnerName
  • PWAEnabled
  • RestrictedToRegion
  • SandboxedCodeActivationCapability
  • SensitivityLabel
  • SetOwnerWithoutUpdatingSecondaryAdmin
  • SharingAllowedDomainList
  • SharingBlockedDomainList
  • SharingCapability
  • SharingDomainRestrictionMode
  • ShowPeoplePickerSuggestionsForGuestUsers
  • SiteDefinedSharingCapability
  • SocialBarOnSitePagesDisabled
  • Status
  • StorageMaximumLevel
  • StorageQuotaType
  • StorageUsage
  • StorageWarningLevel
  • Template
  • TimeZoneId
  • Title
  • Url
  • UserCodeMaximumLevel
  • UserCodeWarningLevel
  • WebsCount
  • Context
  • Tag
  • Path
  • ObjectVersion
  • ServerObjectIsNull
  • TypedObject