Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 371
  • Last Modified:

delete old version sharepoint 2010

the code to delete old version is found in the link below. i have a siite and a subsite only. but when i do this code, it only does one location in the subsite and that's it. it doesn't go to any other places. any idea? thanks

Get-SPWebApplication | Get-SPSite -Limit All | Get-SPWeb -Limit All | ForEach-Object { ForEach($list in $_.Lists) { If($list.EnableVersioning -eq $true) { $list.MajorVersionLimit = 1; $list.Update(); ForEach($item in $list.Items) { $item.URL; $item.SystemUpdate() } } } }


http://iedaddy.com/2011/11/sharepoint-powershelldelete-old-versions-of-documents-and-items/
0
StewSupport
Asked:
StewSupport
  • 4
  • 3
1 Solution
 
Justin SmithSr. System EngineerCommented:
You are saying only one list is affected?  How many lists do you have?  Is versioning enabled on all of them?
0
 
StewSupportAuthor Commented:
yes because if i go to the main site and go to settings then go to recycle bin, i see so many in there
0
 
Justin SmithSr. System EngineerCommented:
I'm not following.  What does the recycle bin have to do with anything?

This script only affects lists that have Versioning enabled.  Do you have more than one list with Versioning enabled?
0
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 
StewSupportAuthor Commented:
If it stores in recycle bin wouldn't that store in the db?
0
 
Justin SmithSr. System EngineerCommented:
Yes but the script isn't going to loop through the recycle bin. Why would you want to?
0
 
StewSupportAuthor Commented:
back to your question, i have 100+ lists on the site and 3 lists on sub site but it only loop through 1 list in subsite
0
 
Justin SmithSr. System EngineerCommented:
I assume you have verified that versioning is in fact enabled on all the lists?  Because your script isn't going to touch it unless its enabled.
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now