How to Show Version History in SharePoint 2013 using PowerShell

Here is the piece of code provided below.
  1. $Site = Get-SPSite http://mysite/Sample
  2. $Webs = $Site.AllWebs
  3. foreach ($Web in $Webs)
  4. {
  5. foreach ($List in $web.Lists)
  6. {
  7. //Check if the Versioning is enabled or not.
  8. if($List.EnableVersioning)
  9. {
  10. $Item=$List.Items[0]
  11. foreach($Version in $Item.Versions)
  12. {
  13. Write-Host “Documen Library Name:” $List.Title “-“ “Document Name:” $Item.Title $Version.VersionLabel
  14. }
  15. }
  16. }
  17. }
  18. $Web.Dispose()
  19. $Site.Dispose()

Happy SharePointing 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s