Powershell script for SharePoint 2010 Site usage analytics
-
13-01-2021 - |
Question
I am trying to figure out powershell commands for SharePoint 2010
TO Analyze Subsite level information
- When was each subsite last modified
- WHen was each subsite last updated
- No. of users for each subsite
- No. of hits on each subsite
And other uselful information to analyze all the content of the site collection, specifically each subsite within.
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
}
More reference: Powershell script for SharePoint 2010 & SharePoint 2007 Site Usage report.
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange