locked
using Powershell to get info on each site and subsite.. like last modified, object counts, object type counts RRS feed

  • Question

  • I have a powershell script that list all webs, sites and subsites on a 2007 farm.

    Any way to get the last modified date of those subsites... that is the last time any object was updated or created?

    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null
     
    $farm = [Microsoft.SharePoint.Administration.SPFarm]::Local
    $websvcs = $farm.Services | where -FilterScript {$_.GetType() -eq [Microsoft.SharePoint.Administration.SPWebService]}
    $webapps = @()
     
    foreach ($websvc in $websvcs) {
               write-host "Web Applications"
               write-host ""
        foreach ($webapp in $websvc.WebApplications) {
            write-host "Webapp Name -->"$webapp.Name
               write-host ""
               write-host "Site Collections"
               write-host ""
        foreach ($site in $webapp.Sites) {
            write-host "Site URL --> -->" $site.URL
               write-host ""
               write-host "Websites"
               write-host ""
        foreach ($web in $site.AllWebs) {
            write-host "Web URL --> --> -->" $web.URL
        }
        }
        }

    }

    Also, any way to get a object count by subsite and site?

    And, finally way to report counts (in powershell or sql) on the folowing:

    - objects with code blocks

    - objects with excel services webparts

    - objects that appear to be infopath forms

    - objects with any particular string

    Thanks.


    ============================
    Thank You
    cyberpine.com


    • Edited by o365spo Wednesday, January 23, 2013 11:55 AM
    Wednesday, January 23, 2013 11:53 AM

All replies

  • Yes. SPWeb Object has LastItemModifiedDate Property. You can just query that:

    Refer: http://www.sharepointdiary.com/2012/03/find-most-active-sites-of-web.html

    You can get the Count of Sites in a site collection by: SPSite.AllWebs.Count

    Wednesday, January 23, 2013 2:46 PM
  • Thank you.

    What about number of objects (not just sites)? And number of objects that contain a particular string ? Would powershell be advised for this?


    ============================
    Thank You
    cyberpine.com

    Thursday, January 24, 2013 11:56 AM
  • Bump..Anybody...

    Total Object counts by site?

    and

    Object counts on web  pages (aspx) that contain  a particular string in the text?

    If not possible with PowerShell, how about with SQL?


    ============================
    Thank You
    cyberpine.com



    • Edited by o365spo Wednesday, February 6, 2013 1:00 PM
    Wednesday, February 6, 2013 12:58 PM