none
Powershell script to extract last modified date RRS feed

  • Question

  • Hi,

    We are coming up with requirements to report the modified dates on the items/documents in our SharePoint 2013 lists and libraries.  Does anybody know of a powershell command to accomplish the same which can be extracted onto a CSV?  Thanks in advance.


    Shonilchi..

    Monday, December 1, 2014 12:20 PM

Answers

  • #Add SharePoint modules and create variable space
    add-pssnapin microsoft.sharepoint.powershell
    start-spassignment -global

    #Open the web site, list and the workflow
    $site=get-spsite https://mysite.com
    $web=get-spweb https://mysite.com/myweb/

    #Open the %affected% library or list and workflow association

    $affected=$web.getlist("Practical Tips")

    #Start workflow
    foreach ($item in $affected.items) {
    $item["Modified"]
    }


    $csvObjects = import-csv $file 
    $NewCSVObject = @()  
    foreach ($item in $affected.items) { 
    {  
        $NewCSVObject += $item | Add-Member -name $item["Title"]-value $item["Modified"] -MemberType NoteProperty  
    }  
    $NewCSVObject | export-csv $File -noType 

    Whenever you see a reply and if you think is helpful,Vote As Helpful! And whenever you see a reply being an answer to the question of the thread, click Mark As Answer

    • Proposed as answer by romeo donca Monday, December 1, 2014 9:07 PM
    • Marked as answer by Lindali Monday, December 22, 2014 8:46 AM
    Monday, December 1, 2014 6:49 PM
  • Hi Shonilchi,

    According to your description, my understanding is that you want to extract the last modified dates on all SharePoint 2013 items and documents then export them into a CSV file.

    There is a PowerShell script which is intended to get the "LastModifiedDate" property (amongst others) of all sites in your SharePoint farm.The gathered informations are exported to a csv file, and optionally sent by email with the report as attachment.

    More information, please refer to the link:

    https://gallery.technet.microsoft.com/office/SharePoint-200720102013-48c9e2b1#content

    Best Regards,

    Wendy


    Wendy Li
    TechNet Community Support

    • Marked as answer by Lindali Monday, December 22, 2014 8:46 AM
    Wednesday, December 3, 2014 8:42 AM
    Moderator

All replies

  • HI Shonilchi

    You may use the below property to get the last modified date.

    $record | Add-Member NoteProperty ModifiedDate ( $item["Modified"])

    Monday, December 1, 2014 12:34 PM
  • #Add SharePoint modules and create variable space
    add-pssnapin microsoft.sharepoint.powershell
    start-spassignment -global

    #Open the web site, list and the workflow
    $site=get-spsite https://mysite.com
    $web=get-spweb https://mysite.com/myweb/

    #Open the %affected% library or list and workflow association

    $affected=$web.getlist("Practical Tips")

    #Start workflow
    foreach ($item in $affected.items) {
    $item["Modified"]
    }


    $csvObjects = import-csv $file 
    $NewCSVObject = @()  
    foreach ($item in $affected.items) { 
    {  
        $NewCSVObject += $item | Add-Member -name $item["Title"]-value $item["Modified"] -MemberType NoteProperty  
    }  
    $NewCSVObject | export-csv $File -noType 

    Whenever you see a reply and if you think is helpful,Vote As Helpful! And whenever you see a reply being an answer to the question of the thread, click Mark As Answer

    • Proposed as answer by romeo donca Monday, December 1, 2014 9:07 PM
    • Marked as answer by Lindali Monday, December 22, 2014 8:46 AM
    Monday, December 1, 2014 6:49 PM
  • Hi Shonilchi,

    According to your description, my understanding is that you want to extract the last modified dates on all SharePoint 2013 items and documents then export them into a CSV file.

    There is a PowerShell script which is intended to get the "LastModifiedDate" property (amongst others) of all sites in your SharePoint farm.The gathered informations are exported to a csv file, and optionally sent by email with the report as attachment.

    More information, please refer to the link:

    https://gallery.technet.microsoft.com/office/SharePoint-200720102013-48c9e2b1#content

    Best Regards,

    Wendy


    Wendy Li
    TechNet Community Support

    • Marked as answer by Lindali Monday, December 22, 2014 8:46 AM
    Wednesday, December 3, 2014 8:42 AM
    Moderator
  • This is what I've hoped for but unfortunately web object's LastItemModifiedDate property doesn't necessarily reflect the last user modification of any item on site.

    Supporting this I would expect that information on "Site actions > View all site content" and the aforementioned property will show the same, but that's not the case. "All site content" shows the last modified list dates about two years ago, while LastItemModifiedDate says it's - a week ago. What? And not one site did I check but dozens.

    I assume iterating through all list's all items would give you the proper information but I've never tried. All in all, LastItemModifiedDate proved to be useless for me. Using Sp2013.

    Thursday, January 11, 2018 12:15 PM