Powershell script to list LastContentModifiedDate

I'm a beginner to Powershell 1.0 and I'm looking to pull some information out of the Sharepoint 2007 farm as we start the upgrade to 2010 planning. This is what I'm wanting to do, but having some difficulty visualizing how to string it all together.

I want to iterate through all the webs in all site collections in a web application and list the site URL and the LastContentModifiedDate in the output and ideally output it to a csv or text file for analysis in Excel.

I can get the web app I want by using $spweb = get-spwebapplication | where{ $_.Displayname -like "*collab*"} but I'm not sure how to get all the site collections from the web app to iterate through all the spwebs.

I'm importing the functions into my profile provided by Zach Rosenfield.

Replay

Updated answer

I'm pretty sure that Get-SPWebApplication does not work with WSS 3.0 or MOSS 2007 (unless you have a custom cmdlet), but the code you need is below.

foreach ($wa in get-spwebapplication | where{ $_.Displayname -like "*collab*"})
{
    Write-Host $wa
    foreach ($site in $wa.Sites)
    {
        Write-Host $site
        foreach ($web in $site.Webs)
        {
            Write-Host $web
        }
    }
}

You just need to get the data required on each $web and do something with it.

Category: 2007 Time: 2011-04-08 Views: 1

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.371 (s). 12 q(s)