Commands › SharePoint Online

Set-SPOSite

SharePoint Online Microsoft.Online.SharePoint.PowerShell Set-*

Sets or updates one or more properties' values for a site collection.

Quick start script

# Set-SPOSite — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-SPOService -Url https://$org-admin.sharepoint.com

# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-SPOSite
$before | Format-List

# 3. Make the change (dry run first)
Set-SPOSite -EnablePWA <Boolean> -FileTypesForVersionExpiration <String[]> -Identity <SpoSitePipeBind> -WhatIf
Set-SPOSite -EnablePWA <Boolean> -FileTypesForVersionExpiration <String[]> -Identity <SpoSitePipeBind>

# 4. Verify and diff
$after = Get-SPOSite
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax — 16 parameter sets

None (Default)

Set-SPOSite [-Identity] <SpoSitePipeBind> [-InformationBarriersMode <String>] [-WhatIf] [-Confirm]
 [<CommonParameters>]

ParamSet1

Set-SPOSite [-Identity] <SpoSitePipeBind> [-Owner <String>] [-Title <String>] [-StorageQuota <Int64>]
 [-StorageQuotaWarningLevel <Int64>] [-ResourceQuota <Double>] [-ResourceQuotaWarningLevel <Double>]
 [-LocaleId <UInt32>] [-AllowSelfServiceUpgrade <Boolean>] [-NoWait] [-LockState <String>]
 [-DenyAddAndCustomizePages <Boolean>] [-SharingCapability <SharingCapabilities>]
 [-ShowPeoplePickerSuggestionsForGuestUsers <Boolean>] [-StorageQuotaReset]
 [-SandboxedCodeActivationCapability <SandboxedCodeActivationCapabilities>]
 [-DisableCompanyWideSharingLinks <CompanyWideSharingLinksPolicy>]
 [-SharingDomainRestrictionMode <SharingDomainRestrictionModes>] [-SharingAllowedDomainList <String>]
 [-SharingBlockedDomainList <String>] [-ConditionalAccessPolicy <SPOConditionalAccessPolicyType>]
 [-AllowDownloadingNonWebViewableFiles <Boolean>] [-LimitedAccessFileType <SPOLimitedAccessFileType>]
 [-AllowEditing <Boolean>] [-ReadOnlyForUnmanagedDevices <Boolean>] [-SensitivityLabel <String>]
 [-DisableAppViews <AppViewsPolicy>] [-DisableFlows <FlowsPolicy>]
 [-MediaTranscription <MediaTranscriptionPolicyType>] [-BlockDownloadPolicy <Boolean>]
 [-ExcludedBlockDownloadGroupIds <Guid[]>] [-ExcludeBlockDownloadPolicySiteOwners <Boolean>]
 [-ReadOnlyForBlockDownloadPolicy <Boolean>] [-ExcludeBlockDownloadSharePointGroups <String[]>]
 [-AuthenticationContextName <String>]
 [-AuthenticationContextAccessType <SPOAuthenticationContextPolicyAccessType>]
 [-RestrictedToGeo <RestrictedToRegion>] [-CommentsOnSitePagesDisabled <Boolean>] [-UpdateUserTypeFromAzureAD]
 [-SocialBarOnSitePagesDisabled <Boolean>] [-HubSiteId <Guid>] [-DefaultSharingLinkType <SharingLinkType>]
 [-DefaultLinkPermission <SharingPermissionType>] [-DefaultLinkToExistingAccess <Boolean>]
 [-DefaultLinkToExistingAccessReset] [-AnonymousLinkExpirationInDays <Int32>]
 [-OverrideTenantAnonymousLinkExpirationPolicy <Boolean>] [-ExternalUserExpirationInDays <Int32>]
 [-OverrideTenantExternalUserExpirationPolicy <Boolean>] [-OrganizationSharingLinkMaxExpirationInDays <Int32>]
 [-OrganizationSharingLinkRecommendedExpirationInDays <Int32>]
 [-OverrideTenantOrganizationSharingLinkExpirationPolicy <Boolean>]
 [-AnyoneSharingLinkRecommendedExpirationInDays <Int32>] [-InformationBarriersMode <String>]
 [-BlockDownloadLinksFileType <BlockDownloadLinksFileTypes>]
 [-OverrideBlockUserInfoVisibility <SiteUserInfoVisibilityPolicyValue>]
 [-LoopDefaultSharingLinkScope <SharingScope>] [-LoopDefaultSharingLinkRole <SharingRole>]
 [-RequestFilesLinkEnabled <Boolean>] [-RequestFilesLinkExpirationInDays <Int32>]
 [-OverrideSharingCapability <Boolean>] [-DefaultMainLinkScope <MainLinkAudience>]
 [-DefaultShareLinkScope <SharingScope>]
 [-DefaultShareLinkRole <SharingRole>] [-BlockGuestsAsSiteAdmin <SharingState>]
 [-RestrictContentOrgWideSearch <Boolean>] [-RestrictedContentDiscoveryforCopilotAndAgents <Boolean>]
 [-RestrictedAccessControl <Boolean>] [-RestrictedAccessControlGroups <Guid[]>]
 [-ListsShowHeaderAndNavigation <Boolean>] [-HidePeoplePreviewingFiles <Boolean>]
 [-HidePeopleWhoHaveListsOpen <Boolean>] [-IsAuthoritative <Boolean>] [-AllowFileArchive <Boolean>]
 [-AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled <Boolean>] [-DisableSiteBranding <Boolean>]
 [-DisableClassicPageBaselineSecurityMode <Boolean>]
 [-WhatIf] [-Confirm] [<CommonParameters>]

ParamSet2

Set-SPOSite [-Identity] <SpoSitePipeBind> -EnablePWA <Boolean> [-InformationBarriersMode <String>] [-WhatIf]
 [-Confirm] [<CommonParameters>]

ParamSet3

Set-SPOSite [-Identity] <SpoSitePipeBind> [-DisableSharingForNonOwners] [-InformationBarriersMode <String>]
 [-WhatIf] [-Confirm] [<CommonParameters>]

12 more parameter sets — see the parameter table below.

Parameters (98)

ParameterTypeRequiredWhat it controls
-AddInformationSegment Guid[] This parameter allows you to add a segment to a SharePoint site. This parameter is only applicable for tenants who have enabled Microsoft 365 Information barriers capability. Please read...
-AddRestrictedAccessControlGroups Guid[] Specifies the IDs of groups to be added to an access restriction policy and gain access.
-AllowDownloadingNonWebViewableFiles Boolean Specifies if non web viewable files can be downloaded.
-AllowEditing Boolean Prevents users from editing Office files in the browser and copying and pasting Office file contents out of the browser window.
-AllowFileArchive Boolean This setting enables or disables the file archive feature for a SharePoint site. If this parameter is passed as true for a site and Microsoft 365 Archive is enabled at the tenant-level, then the site will allow file archive.
-AllowSelfServiceUpgrade Boolean Determines whether site collection administrators can upgrade their site collections.
-AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled Boolean Enables or disables web property bag updates. When `AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled` is set to `$true`, the web property bag can be updated even if the Add And Customize Pages right is...
-DisableClassicPageBaselineSecurityMode Boolean Allows a site to disable baseline security mode for classic pages. When `DisableClassicPageBaselineSecurityMode` is set to `$true`, users can create and edit classic pages even if baseline security mode is enabled at...
-AnonymousLinkExpirationInDays Int32 Specifies all anonymous/anyone links that have been created (or will be created) will expire after the set number of days. Only applies if OverrideTenantAnonymousLinkExpirationPolicy is set to true.
-AnyoneSharingLinkRecommendedExpirationInDays Int32 Specifies the recommended number of days before Anyone (anonymous) sharing links expire for this site. This setting provides a suggested expiration period to users when they create sharing links. Only applies if...
-ApplyToExistingDocumentLibraries SwitchParameter Create a job to apply the version history limits setting to existing document libraries.
-ApplyToNewDocumentLibraries SwitchParameter Apply the version history limits setting to new document libraries.
-AuthenticationContextAccessType SPOAuthenticationContextPolicyAccessType Controls whether Authentication Context Limited Access is enabled for a site.
-AuthenticationContextName String The conditional access authentication context name.
-BlockDownloadLinksFileType BlockDownloadLinksFileTypes The valid values are:
-BlockDownloadPolicy Boolean As a SharePoint administrator in Microsoft 365, you can block the download of files from SharePoint sites or OneDrive. This feature does not need Microsoft Entra Conditional Access policies. This feature can be set...
-BlockGuestsAsSiteAdmin SharingState Whether to block guests as site admins.
-ClearGroupId SwitchParameter This parameter allows you to remove the assigned Microsoft 365 group ID on a site, when the group is permanently deleted.
-ClearRestrictedAccessControl SwitchParameter Clears the list of groups that are given access via an access restriction policy.
-ClearSharingLockDown SwitchParameter Whether to clear the sharing lockdown for the site.
-CommentsOnSitePagesDisabled Boolean Use this parameter to disable Comments section on Site Pages. The parameter can't be used for Groups Site Collections.
-ConditionalAccessPolicy SPOConditionalAccessPolicyType Please read [Control access from unmanaged devices](/sharepoint/control-access-from-unmanaged-devices) documentation here to understand Conditional Access Policy usage in SharePoint Online.
-DefaultLinkPermission SharingPermissionType The default link permission for the site collection. To be replaced by DefaultShareLinkRole.
-DefaultLinkToExistingAccess Boolean When set to TRUE, the DefaultSharingLinkType will be overriden and the default sharing link will be a People with Existing Access link (which does not modify permissions). When set to FALSE (the default), the...
-DefaultLinkToExistingAccessReset SwitchParameter Whether to reset the default link to existing access to the site.
-DefaultMainLinkScope MainLinkAudience The default audience for main links used in sharing. Applies to all items at the root of the document library. Only audience scope is set by this parameter. The default effective value is `OnlyPeopleAdded`.
-DefaultShareLinkRole SharingRole The default share link role for the site collection. It replaces `DefaultLinkPermission`.
-DefaultShareLinkScope SharingScope The default share link scope on the site. It replaces `DefaultSharingLinkType`.
-DefaultSharingLinkType SharingLinkType The default link type for the site collection. To be replaced by DefaultShareLinkScope.
-DenyAddAndCustomizePages Boolean Determines whether the Add And Customize Pages right is denied on the site collection. For more information about permission levels, see User permissions and permission levels in SharePoint.
-DisableAppViews AppViewsPolicy **Note**: This parameter has been retired and no longer functions.
-DisableCompanyWideSharingLinks CompanyWideSharingLinksPolicy Disables People in your organization links. For more information, see [People in your organization sharing links](/microsoft-365/solutions/microsoft-365-limit-sharing#people-in-your-organization-sharing-links).
-DisableFlows FlowsPolicy **Note**: This parameter has been retired and no longer functions.
-DisableSharingForNonOwners SwitchParameter This parameter prevents non-owners from inviting new users to the site.
-DisableSiteBranding Boolean Enables or disables site branding. When `DisableSiteBranding` is set to `$true`, the site branding is disabled on the site collection.
-IsAuthoritative Boolean When an admin with a Copilot license marks a site as authoritative, it signals to Microsoft Search, Microsoft 365 Copilot, and other AI agents that the content is official, trusted, and verified. This designation...
-EnableAutoExpirationVersionTrim Boolean SharePoint Administrators can set site-level version history limit settings that universally apply to new versions created on all new document libraries created on the site. Also can create request to set the version...
-EnablePWA Boolean yes Determines whether site can include Project Web App. For more information about Project Web App, see Plan SharePoint groups in Project Server.
-ExcludeBlockDownloadPolicySiteOwners Boolean Controls if site owners are excluded from block download policy.
-ExcludeBlockDownloadSharePointGroups String[] Specifies the groups excluded from the block download policy.
-ExcludedBlockDownloadGroupIds Guid[] Exempts users from specified groups from the block download policy and they can fully download any content for the site.
-ExpireVersionsAfterDays Int32 When version history limits are managed manually (`EnableAutoExpirationVersionTrim $false`), admins will need to set the limits to the number of major versions (`MajorVersionLimit`), the number of major with minor...
-ExternalUserExpirationInDays Int32 Specifies all external user expiration which will expire after the set number of days. Only applies if OverrideTenantExternalUserExpirationPolicy is set to true.
-FileTypesForVersionExpiration String[] yes An array of file type names. The supported file type names are: - Audio - OutlookPST - Video
-HidePeoplePreviewingFiles Boolean This setting disables the feature in OneDrive and SharePoint file previewing that displays the presence of other users on the file. It does not affect any experiences outside of the previewer.
-HidePeopleWhoHaveListsOpen Boolean This setting disables the feature in Microsoft Lists that displays the presence of other users on the list and its items when they are viewing.
-HubSiteId Guid Sets the hub site for a specified SharePoint site.
-Identity SpoSitePipeBind yes Specifies the URL of the site collection to update.
-InformationBarriersMode String Specifies the information barrier mode.
-InheritVersionPolicyFromTenant SwitchParameter Clear the file version setting at the site level. The new document libraries will use the Tenant Level setting. It won't impact the existing document libraries.
-LimitedAccessFileType SPOLimitedAccessFileType The following parameters can be used with -ConditionalAccessPolicy AllowLimitedAccess for both the organization-wide setting and the site-level setting.
-ListsShowHeaderAndNavigation Boolean Whether users see the full SharePoint chrome when they open a list.
-LocaleId UInt32 Specifies the language of this site collection. For more information, see Locale IDs Assigned by Microsoft (https://go.microsoft.com/fwlink/p/?LinkId=242911) (https://go.microsoft.com/fwlink/p/?LinkId=242911).
-LockState String Sets the lock state on a site. Valid values are: NoAccess, ReadOnly and Unlock. When the lock state of a site is ReadOnly, a message will appear on the site stating that the site is under maintenance and it is...
-LoopDefaultSharingLinkRole SharingRole Gets or sets default share link role for fluid on the site.
-LoopDefaultSharingLinkScope SharingScope Gets or sets default share link scope for fluid on the site.
-MajorVersionLimit Int32 When version history limits are managed manually (`EnableAutoExpirationVersionTrim $false`), admins will need to set the limits to the number of major versions (`MajorVersionLimit`) and the time period the versions...
-MajorWithMinorVersionsLimit Int32 When version history limits are managed manually (`EnableAutoExpirationVersionTrim $false`), admins will need to set the limits to the number of major versions (`MajorVersionLimit`), the number of major with minor...
-MediaTranscription MediaTranscriptionPolicyType When the feature is enabled, videos can have transcripts generated on demand or generated automatically in certain scenarios. This is the default because the policy is default on. If a video owner decides they don't...
-NoWait SwitchParameter Specifies to continue executing script immediately.
-OrganizationSharingLinkMaxExpirationInDays Int32 Specifies the maximum number of days before organization sharing links expire for this site.
-OrganizationSharingLinkRecommendedExpirationInDays Int32 Specifies the recommended number of days before organization sharing links expire for this site. This setting provides a suggested expiration period to users when they create sharing links.
-OverrideBlockUserInfoVisibility SiteUserInfoVisibilityPolicyValue Choose whether to override the Block User Info Visibility policy on this site.
-OverrideSharingCapability Boolean Determines whether it should override the sharing capability on its partition. For example, if the tenant sharing capability is `ExternalUserAndGuestSharing`, the core partition sharing capability is `Disabled`, and...
-OverrideTenantAnonymousLinkExpirationPolicy Boolean Choose whether to override the anonymous or anyone link expiration policy on this site.
-OverrideTenantExternalUserExpirationPolicy Boolean Choose whether to override the external user expiration policy on this site.
-OverrideTenantOrganizationSharingLinkExpirationPolicy Boolean Choose whether to override the tenant-level organization sharing link expiration policy on this site. Overrides both the maximum and recommended values.
-Owner String Specifies the owner of the site collection. Changing the Owner of a OneDrive is not supported and causes many experiences to break.
-ReadOnlyForBlockDownloadPolicy Boolean Controls if read-only should be enabled for block download policy.
-ReadOnlyForUnmanagedDevices Boolean Controls whether unmanaged devices have read-only access.
-RemoveInformationSegment Guid[] This parameter allows you to remove a segment from a SharePoint site. This parameter is only applicable for tenants who have enabled Microsoft 365 Information barriers capability. Please read...
-RemoveLabel SwitchParameter This parameter allows you to remove the assigned sensitivity label on a site.
-RemoveRestrictedAccessControlGroups Guid[] Specifies the IDs of groups to be removed from access restriction policy and lose access.
-RemoveVersionExpirationFileTypeOverride String[] yes An array of file type names. Removes the version history limits to a set of file types so that they will follow the default version history limits.
-RequestFilesLinkEnabled Boolean Enables or disables the Request Files link on the site.
-RequestFilesLinkExpirationInDays Int32 Specifies the number of days before a Request Files link expires for the site.
-ResourceQuota Double Specifies the resource quota in megabytes of the site collection. The default value is 0. For more information, see Resource Usage Limits on Sandboxed Solutions in SharePoint 2010...
-ResourceQuotaWarningLevel Double Specifies the warning level in megabytes of the site collection to warn the site collection administrator that the site is approaching the resource quota.
-RestrictContentOrgWideSearch Boolean Controls whether org-wide content search is enabled for a site.
-RestrictedAccessControl Boolean Sets access restriction policy by group membership.
-RestrictedAccessControlGroups Guid[] Specifies the IDs of groups that have access under an access restriction policy.
-RestrictedContentDiscoveryforCopilotAndAgents Boolean Sets or updates the site setting to host Agents by activating or deactivating the Restricted Content Discovery (RCD) for Agents. *Currently under private preview.*
-RestrictedToGeo RestrictedToRegion PARAMVALUE: NoRestriction | BlockMoveOnly | BlockFull | Unknown
-SandboxedCodeActivationCapability SandboxedCodeActivationCapabilities PARAMVALUE: Unknown | Check | Disabled | Enabled
-SensitivityLabel String Used to specify the unique identifier (GUID) of the SensitivityLabel.
-SharingAllowedDomainList String Specifies a list of email domains that are allowed for sharing with the external collaborators. Use the space character as the delimiter for entering multiple values. For example, "contoso.com fabrikam.com".
-SharingBlockedDomainList String Specifies a list of email domains that are blocked or prohibited for sharing with the external collaborators. Use space character as the delimiter for entering multiple values. For example, "contoso.com fabrikam.com".
-SharingCapability SharingCapabilities Determines what level of sharing is available for the site.
-SharingDomainRestrictionMode SharingDomainRestrictionModes Specifies the sharing mode for external domains.
-ShowPeoplePickerSuggestionsForGuestUsers Boolean To enable the option to search for existing guest users at site collection level, set this parameter to $true.
-SocialBarOnSitePagesDisabled Boolean Disables or enables the Social Bar for Site Collection.
-StorageQuota Int64 Specifies the storage quota in megabytes of the site collection.
-StorageQuotaReset SwitchParameter Resets the OneDrive for Business storage quota to the tenant's new default storage space.
-StorageQuotaWarningLevel Int64 Specifies the warning level in megabytes of the site collection to warn the site collection administrator that the site is approaching the storage quota.
-Title String Specifies the title of the site collection.
-UpdateUserTypeFromAzureAD SwitchParameter Whether to update user types for all users in the site to match what's in Entra.
-Confirm SwitchParameter Prompts you for confirmation before running the cmdlet.
-WhatIf SwitchParameter The WhatIf switch doesn't work on this cmdlet.

Message Center changes mentioning this command

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.