[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 374
  • 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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