SharePoint Online PowerShell – resolving error – Set-SPOTenant : A parameter cannot be found that matches parameter name ‘EnableVersionExpirationSetting’

Hi All,
Greetings for the day!
Today new issue and solution 🙂
Background / Details
- In my development tenant I am exploring recently added new feature from Microsoft related to Document Libraries Versioning improvements.
- New Feature – Microsoft SharePoint document libraries: Improved Version history controls – Microsoft is introducing new version controls that help tenant and site admins or document library owners reduce the storage footprint driven by low value file version.
- To enable the setting – to set version history limits at tenant level, admins need to execute the following CMDLET – Set-SPOTenant
Set-SPOTenant -EnableVersionExpirationSetting $true
- While executing the above POWERSHELL CMDLET we are getting an error.
ISSUE / ERROR
Set-SPOTenant : A parameter cannot be found that matches parameter name ‘EnableVersionExpirationSetting’.
Set-SPOTenant -EnableVersionExpirationSetting $true
Set-SPOTenant : A parameter cannot be found that matches parameter name ‘EnableVersionExpirationSetting’.
At line:2 char:15
- Set-SPOTenant -EnableVersionExpirationSetting $true
~~~~~~~- CategoryInfo : InvalidArgument: (:) [Set-SPOTenant], ParameterBindingException
- FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Online.SharePoint.PowerShell.SetTenant

SOLUTION
- This error is there since there is old version “SharePoint Online PowerShell” installed on my computer.
- We could verify the current version of – “SharePoint Online PowerShell” module using below PowerShell CMDLET
PS C:\>
Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable | Select Name,Version
Name Version
---- -------
Microsoft.Online.SharePoint.PowerShell 16.0.23408.12000
Microsoft.Online.SharePoint.PowerShell 16.0.21513.12000

- “
EnableVersionExpirationSetting” parameter to “Set-SPOTenant” is available in “SharePoint Online PowerShell” Module having version 16.0.24810.12000 or higher
- We need to update the install “SharePoint Online PowerShell” module.
- Using following PowerShell CMDLET, we will update the “SharePoint Online PowerShell” with latest version – Update-Module
Update-Module -Name Microsoft.Online.SharePoint.PowerShell -Force
- We could confirm the updated version of module “Microsoft.Online.SharePoint.PowerShell” by executing “Get-Module” CMDLET
PS C:\> Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable | Select Name,Version
Name Version
---- -------
Microsoft.Online.SharePoint.PowerShell 16.0.25221.12000

We have detailed article on PowerShell modules CMDLETs – PowerShell – Exploring Module CMDLETs – https://knowledge-junction.in/2022/12/12/__trashed-2/
- As we updated latest version of “SharePoint Online PowerShell” module we are able to execute the “Set-SPOTenant” CMDLET successfully 🙂
PS C:\> Set-SPOTenant -EnableVersionExpirationSetting $true
NOTE : We may need to restart the “PowerShell ISE” to have the effect of latest “SharePoint Online PowerShell” module.
- We could verify if setting is applied or not by executing “Get-SPOTenant” CMDLET as
PS C:\> Get-SPOTenant | Select EnableVersionExpirationSetting
EnableVersionExpirationSetting
------------------------------
True

We have around 200+ PowerShell CMDLETs. Specially for Microsoft 365 / SharePoint. Please have a look – https://knowledge-junction.in/category/technology-articles/powershell-cmdlets/
Thanks for reading!!! HAVE A FANTASTIC TIME AHEAD ! ENJOY BEAUTIFUL LIFE 🙂

You must be logged in to post a comment.