Get-SPOSite
Returns one or more site collections.
Syntax
Get-SPOSite
[[-Identity] <SpoSitePipeBind>]
[-Detailed]
[-Limit <String>]
[<CommonParameters>]
Get-SPOSite
[-Detailed]
[-Filter <String>]
[-IncludePersonalSite <Boolean>]
[-Limit <String>]
[-Template <String>]
[-GroupIdDefined]
[-ArchiveStatus <String>]
[<CommonParameters>]
Get-SPOSite
[-Identity] <SpoSitePipeBind>
[-DisableSharingForNonOwnersStatus]
[<CommonParameters>]
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.
Site redirects, like the ones created after changing the SharePoint domain name will be retrieved by using this cmdlet.
You need to be a SharePoint Online 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, InformationSegment, LimitedAccessFileType, OverrideTenantAnonymousLinkExpirationPolicy, OverrideTenantExternalUserExpirationPolicy, PWAEnabled, SandboxedCodeActivationCapability, SensitivityLabel, SharingAllowedDomainList, SharingBlockedDomainList, SharingCapability, SharingDomainRestrictionMode.
Examples
-----------------------EXAMPLE 1-----------------------------
Get-SPOSite
Example 1 returns all site collections.
-----------------------EXAMPLE 2-----------------------------
Get-SPOSite -Identity https://contoso.sharepoint.com
Example 2 lists the site collection with detailed properties.
-----------------------EXAMPLE 3-----------------------------
Get-SPOSite -Identity https://contoso.sharepoint.com -DisableSharingForNonOwnersStatus
Example 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:$false
This example enumerates Group Site Collections in a tenant.
-----------------------EXAMPLE 5-----------------------------
Get-SPOSite -Identity https://contoso.sharepoint.com/sites/groupname -detailed |fl
This example gets quota details for a Group Site.
-----------------------EXAMPLE 6-----------------------------
Get-SPOSite -Identity https://contoso.sharepoint.com/sites/research | Select InformationSegment
This example returns the InformationSegments associated with the site. It is applicable for tenants who have enabled Microsoft 365 Information barriers capability. Read Learn about information barriers to understand Information barriers in SharePoint Online.
Note: This property is available only in SharePoint Online Management Shell Version 16.0.19927.12000 or later.
-----------------------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 $true
This example uses server-side filtering to return all sites that have an associated Microsoft 365 Group.
-----------------------EXAMPLE 11-----------------------------
$userUPN="[email protected]"
Get-SPOSite -Filter "Owner -like '$($userUPN)'"
This example retrieves all sites filtering by the specified owner using a variable.
Parameters
-ArchiveStatus
Displays sites of a specific archive status. For example, NotArchived, RecentlyArchived, FullyArchived, Archived, or Reactivating.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Online |
-Detailed
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 |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Online |
-DisableSharingForNonOwnersStatus
This parameter prevents non-owners from sharing.
Note
This parameter is available only in SharePoint Online Management Shell Version 16.0.4613.1211 or later. DisableSharingForNonOwnersStatus is not a persisted setting but rather an analysis of the state of the site collection. The purpose of this is to get this setting, and it's not guaranteed that other settings returned are correct. To get other settings and values, use the Get-SPOSite without this parameter to ensure everything is displayed correctly.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Online |
-Filter
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 <operator> "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 |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Online |
-GroupIdDefined
Filters 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 |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Online |
-Identity
Specifies the URL of the site collection.
Type: | SpoSitePipeBind |
Position: | 0 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Online |
-IncludePersonalSite
Displays 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 |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Online |
-Limit
Specifies 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 |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Online |
-Template
Displays 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 |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Online |
Inputs
Microsoft.Online.SharePoint.PowerShell.SpoSitePipeBind
Outputs
System.Object