I am trying to figure out powershell commands for SharePoint 2010

TO Analyze Subsite level information

  1. When was each subsite last modified
  2. WHen was each subsite last updated
  3. No. of users for each subsite
  4. No. of hits on each subsite

And other uselful information to analyze all the content of the site collection, specifically each subsite within.


1 Answer 1


There is a demo below.

$Site=Get-SPSite http://sp

 foreach ($web in $site.AllWebs) {
                         $siteUrl = $web.Url
                         $siteName = $web.Title
                         $siteUserCnt = $web.AllUsers.Count
                         $siteusage = $site.Usage.Storage/1MB
                         $Hits = $site.Usage.Hits                       
                         $Created = [datetime]$web.Created
                         $LastModified = $Web.LastItemModifiedDate
                         $SnapShot = (get-date)
                         $LastUpdate = ($SnapShot – [datetime]$LastModified)

                         $outputToCSV = New-Object PSObject -Property @{"Site Title" = $siteName
                         "Url" = $siteUrl
                         "Total Users" =$siteUserCnt
                         "Size" = $siteusage
                         "Date Last Modified" = $LastModified
                         "Days Last Update" = $LastUpdate
                         "Hits" =$Hits
                         "Date Created" =$Created

                            $outputToCSV | out-file -FilePath "C:\test\test2.csv" -Append


The result as below: enter image description here

More reference: Powershell script for SharePoint 2010 & SharePoint 2007 Site Usage report.

  • this is not giving size of subsite. $site.Usage.Storage gives size of sitecollection. I have a requirement to get size of each subsites also.
    – Preeti
    Feb 19, 2021 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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