SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I am trying to extract version history from a document library in Powershell. I have found the commands/scripts to do this. However I cannot seem to get the comments. From my script I can get modified date ($Ver.Created), user ($Ver.CreatedBy), and version ($Ver.VersionLabel) where $Ver is derived from the foreachloop that loops through Items in a Document Library.

I checked Microsoft's Object members site and found 'Comments', but this has produced nothing. I have tried "Comment", "CheckedInComments", "CheckedInComment".

At this point I am trying to find the script that will extract all member names so I can see which one it is. And yes I do have comments there.

The internet has helped. It helped me make the script I have so far but it looks like all the examples I have found do not talk about the comments at all.

----Update----- I found the member, altering the script to look like this:

$Ver["Check In Comment"]

Instead of this:


I get results but its only the last comment of the latest version. The object gets me different data ("VersionLabel") except for the comments

foreach ($item in $ItemsColl)  
    if ($item.Name -eq $fileName)
    Write-Output "File Name " $item.Name | Out-File $logFile -append
        foreach($Ver in $item.Versions)
            Write-Output "Version Label" $Ver.VersionLabel " Created " $Ver.Created " Modified by " $Ver.CreatedBy.User.DisplayName | Out-File $logFile -append
            Write-Output "Check In Comment " $Ver["Check In Comment"] | Out-File $logFile -append
share|improve this question
up vote 3 down vote accepted

You are iterating through the version history for the list item itself but it sounds like what you want is the information for the file versions which is a little deeper. There is a .File property off of the SPListItem that returns an SPFile object. That object has a Versions collection that you need to iterate through to get the information you want.

share|improve this answer
That makes sense ... Will work on that. – fraygos Aug 7 '12 at 13:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.