powershell – Set-SPOSite not working for Group enabled SharePoint Online sites


I’m executing the below script to disable one of the document sharing options:

set-sposite -Identity “https://tenant.sharepoint.com/sites/useraccessmanagement” -DisableCompanyWideSharingLinks Disabled

This script is displaying the below error for all Group enabled SharePoint Online sites but for other sites, it is working as expected.

Error Screenshot and Error Text:

enter image description here

set-sposite :
https://tenant.sharepoint.com/sites/UserAccessManagement is a
Groups site collection. The valid parameters for this type of site
collection are ‘-Identity’, ‘-AllowSelfServiceUpgrade’,
‘-DefaultLinkPermission’, ‘-DefaultSharingLinkType’,
‘-DenyAddAndCustomizePages’, ‘-DisableCompanyWideSharingLinks’,
‘-DisableSharingForNonOwners’, ‘-LockState’, ‘-Owner’,
‘-ResourceQuota’, ‘-ResourceQuotaWarningLevel’,
‘-SandboxedCodeActivationCapability’, ‘-SharingCapability’,
‘-ShowPeoplePickerSuggestionsForGuestUsers’,
‘-SocialBarOnSitePagesDisabled’, ‘-StorageQuota’,
‘-StorageQuotaReset’, and ‘-StorageQuotaWarningLevel’. At line:1
char:1
+ set-sposite -Identity “https://tenant.sharepoint.com/sites/useraccessmanageme …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) (Set-SPOSite), ServerException
+ FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerException,Microsoft.Online.SharePoint.PowerShell.SetSite