Get-SPOSite
Returns one or more site collections.
In this article
Syntax
Get-SPOSite [[-Identity] ] [-Detailed] [-Limit ] [] Get-SPOSite [-Detailed] [-Filter ] [-IncludePersonalSite ] [-Limit ] [-Template ] [-GroupIdDefined] [] Get-SPOSite [-Identity] [-DisableSharingForNonOwnersStatus] []Description
This cmdlet contains more than one parameter set. You may only use parameters from one parameter set and you may not combine parameters from different parameter sets. For more information about how to use parameter sets, see Cmdlet Parameter Sets.
The Get-SPOSite cmdlet retrieves and returns properties of all site collections that match the given criteria.
With version 5361 of the SharePoint Online Management Shell, you may experience the following:
Additional site collections are now displayed. For example, all group and video sites along with team sites will be displayed.
The Detailed parameter has been deprecated. It will continue to work with earlier versions
Note
Site collections in the Recycle Bin will not be retrieved by using the Get-SPOSite cmdlet.
You need to be a SharePoint Online administrator or Global Administrator and be a site collection administrator to run the cmdlet.
For permissions and the most current information about Windows PowerShell for SharePoint Online, see the online documentation at Intro to SharePoint Online Management Shell.
Note
If Site Collection Storage Management is enabled for the tenant, you will not be able to set quota and will have a generic error returned. To workaround this issue, set the site collection storage management to "manual" temporarily, set your quotas and then set the site collection storage management setting back to its original setting.
Note
If the Limit or Filter parameters are provided then the following site collection properties will not be populated and may contain a default value: AllowDownloadingNonWebViewableFiles, AllowEditing, AllowSelfServiceUpgrade, AnonymousLinkExpirationInDays, ConditionalAccessPolicy, DefaultLinkPermission, DefaultLinkToExistingAccess, DefaultSharingLinkType, DenyAddAndCustomizePages, DisableCompanyWideSharingLinks, ExternalUserExpirationInDays, LimitedAccessFileType, OverrideTenantAnonymousLinkExpirationPolicy, OverrideTenantExternalUserExpirationPolicy, PWAEnabled, SandboxedCodeActivationCapability, SensitivityLabel, SharingAllowedDomainList, SharingBlockedDomainList, SharingCapability, SharingDomainRestrictionMode.
Examples
-----------------------EXAMPLE 1-----------------------------
Get-SPOSiteExample 1 returns all site collections.
-----------------------EXAMPLE 2-----------------------------
Get-SPOSite -Identity //contoso.sharepoint.comExample 2 lists the site collection with detailed properties.
-----------------------EXAMPLE 3-----------------------------
Get-SPOSite -Identity //contoso.sharepoint.com -DisableSharingForNonOwnersStatusExample 3 Updates status on if the non owners of a site collection can share the site collection [does not set this value].
-----------------------EXAMPLE 4-----------------------------
Get-SPOSite -Template GROUP#0 -IncludePersonalSite:$falseThis example enumerates Group Site Collections in a tenant.
-----------------------EXAMPLE 5-----------------------------
Get-SPOSite -Identity //contoso.sharepoint.com/sites/groupname -detailed |flThis example gets quota details for a Group Site.
-----------------------EXAMPLE 6-----------------------------
Get-SPOSite -Identity //contoso.sharepoint.com/sites/research | Select InformationSegmentThis example returns the InformationSegments associated to the site.
-----------------------EXAMPLE 7-----------------------------
Get-SPOSite -Filter { Url -like "contoso.sharepoint.com/sites/18" }This example uses server side filtering to return sites matching 18.
-----------------------EXAMPLE 8-----------------------------
Get-SPOSite -Limit ALL | ?{$_.IsTeamsConnected -eq $true}This example uses client-side filtering to return a list of sites connected to Microsoft Teams.
-----------------------EXAMPLE 9-----------------------------
Get-SPOSite -Limit ALL | ?{$_.IsTeamsChannelConnected -eq $true}This example uses client-side filtering to return a list of sites connected to a Microsoft Teams Private or Shared channel.
-----------------------EXAMPLE 10-----------------------------
Get-SPOSite -Limit ALL -GroupIdDefined $trueThis example uses server-side filtering to return all sites that have an associated Microsoft 365 Group.
Parameters
Use this parameter to get additional property information on a site collection. You will notice a slower response time when the Detailed parameter is used.
The following properties are returned:
ResourceUsageCurrent
ResourceUsageAverage
StorageUsageCurrent
LockIssue
WebsCount
CompatibilityLevel
AllowSelfServiceUpgrade
SiteDefinedSharingCapability
Returns the stored value of the site policy.
- SharingCapability
Returns the effective access level, which is the site policy and the tenant policy combined.
Type:SwitchParameter Position:Named Default value:None Accept pipeline input:False Accept wildcard characters:False Applies to:SharePoint OnlineThis parameter prevents non-owners from sharing.
Note
This parameter is available only in SharePoint Online Management Shell Version 16.0.4613.1211 or later.
Specifies the script block of the server-side filter to apply. The type must be a valid filter name and value must be in the form { PropertyName "filterValue"}. Valid operators are as follows: -eq, -ne, -like, -notlike. Currently, you can filter by these properties: Owner, Template [can be used to filter if it is the only property present in the filter], LockState, Url. Using the -or operator to include an additional filter is not supported.
Note: The operator values are case-sensitive.
Type:String Position:Named Default value:None Accept pipeline input:False Accept wildcard characters:False Applies to:SharePoint OnlineFilters the list of sites returned to sites with a Group ID [ie: Sites connected to an Microsoft 365 Group] when the value is set to $true. Filters the list of sites to only sites without a Group ID when the value is $false.
The values are $true, $false, and not defined. By default, the value is not defined, which means that the filter does not apply.
Type:Boolean Position:Named Default value:None Accept pipeline input:False Accept wildcard characters:False Applies to:SharePoint OnlineSpecifies the URL of the site collection.
Type:SpoSitePipeBind Position:0 Default value:None Accept pipeline input:True Accept wildcard characters:False Applies to:SharePoint OnlineDisplays personal sites when value is set to $true.
The values are $true and $false. By default, the value is $false which means no personal sites will be returned.
Type:Boolean Position:Named Default value:None Accept pipeline input:False Accept wildcard characters:False Applies to:SharePoint OnlineThis parameter displays the segments associated with a site.
It is applicable for tenants who have enabled Microsoft 365 Information barriers capability. Please read //docs.microsoft.com/microsoft-365/compliance/information-barriers documentation to understand Information barriers in SharePoint Online.
Note: This parameter is available only in SharePoint Online Management Shell Version 16.0.19927.12000 or later.
Type:Collection of GUIDs Position:Named Default value:None Accept pipeline input:False Accept wildcard characters:False Applies to:SharePoint OnlineSpecifies the maximum number of site collections to return. It can be any number. To retrieve all site collections, use ALL. The default value is 200. If this parameter is provided, then some site collection properties will not be populated and may contain a default value.
Type:String Position:Named Default value:None Accept pipeline input:False Accept wildcard characters:False Applies to:SharePoint OnlineDisplays sites of a specific template. For example, STS, STS#0, STS#1, STS#3, GROUP#0, SRCHCEN#0 or SITEPAGEPUBLISHING#0.
Type:String Position:Named Default value:None Accept pipeline input:False Accept wildcard characters:False Applies to:SharePoint OnlineInputs
Microsoft.Online.SharePoint.PowerShell.SpoSitePipeBind
Outputs
System.Object