Forum Discussion
rohankapz
Sep 21, 2023Copper Contributor
Powershell script to delete all versions of files in a sharepoint site from all libraries
Please can I get some help in compiling a powershell script which will delete all versions of all files and folder in a Sharepoint site but keep the latest 10 versions of this file. My Org site space...
nikkichapple
Sep 29, 2024MVP
I recommend you try the new Version History Limits (Preview), as there are several ways to delete file versions. I think the most useful is the auto setting, which allows you to trim (delete) versions based on age and inactivity or you can keep the last N versions. I have written a detailed blog on it https://nikkichapple.com/sharepoint-version-history-limits-preview/