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

PowerShell - Error while executing CMDLET - Set-SPOTenant -EnableVersionExpirationSetting $true
PowerShell - Error while executing CMDLET - Set-SPOTenant -EnableVersionExpirationSetting $true

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
PowerShell - Error while executing CMDLET - Set-SPOTenant -EnableVersionExpirationSetting $true
fig : 1 – PowerShell – Error while executing CMDLET – Set-SPOTenant -EnableVersionExpirationSetting $true

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

PowerShell - Get-Module - know the current version of SharePoint PowerShell module installed
fig : 2 – PowerShell – Get-Module – know the current version of SharePoint PowerShell module installed
  • “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

PowerShell - Get-Module - know the current version of SharePoint PowerShell module installed

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

 PowerShell - Get-SPOTenant - know the value of specific property - here "EnableVesionExpirationSetting"
fig : 3 – PowerShell – Get-SPOTenant – know the value of specific property – here “EnableVesionExpirationSetting”

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 🙂

Prasham Sabadra

LIFE IS VERY BEAUTIFUL. ENJOY THE WHOLE JOURNEY :) Founder of Microsoft 365 Junction, Speaker, Author, Learner, Developer, Passionate Techie. Certified Professional Workshop Facilitator / Public Speaker. Believe in knowledge sharing. Around 20+ years of total IT experience and 17+ years of experience in SharePoint and Microsoft 365 services Please feel free me to contact for any SharePoint / Microsoft 365 queries. I am also very much interested in behavioral (life changing) sessions like motivational speeches, Success, Goal Setting, About Life, How to live Life etc. My book - Microsoft 365 Power Shell hand book for Administrators and Beginners and 100 Power Shell Interview Questions - https://www.amazon.in/Microsoft-Administrators-Beginners-Interview-Questions/dp/9394901639/ref=tmm_pap_swatch_0?_encoding=UTF8&qid=1679029081&sr=8-11

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.