Solved

delete old version sharepoint 2010

Posted on 2013-01-24
7
317 Views
Last Modified: 2013-01-31
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
Comment
Question by:StewSupport
  • 4
  • 3
7 Comments
 
LVL 38

Expert Comment

by:Justin Smith
ID: 38816675
You are saying only one list is affected?  How many lists do you have?  Is versioning enabled on all of them?
0
 

Author Comment

by:StewSupport
ID: 38816690
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
 
LVL 38

Accepted Solution

by:
Justin Smith earned 500 total points
ID: 38816955
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 Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 

Author Comment

by:StewSupport
ID: 38817244
If it stores in recycle bin wouldn't that store in the db?
0
 
LVL 38

Expert Comment

by:Justin Smith
ID: 38818420
Yes but the script isn't going to loop through the recycle bin. Why would you want to?
0
 

Author Comment

by:StewSupport
ID: 38818646
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
 
LVL 38

Expert Comment

by:Justin Smith
ID: 38818834
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

We had a requirement to extract data from a SharePoint 2010 Customer List into a CSV file and then place the CSV file into a directory on the network so that the file could be consumed by an AS400 system. I will share in Part 1 how to Extract the Da…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now