Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top