Forum Discussion
Istvan Ybema
Jun 10, 2020Brass Contributor
LastContentModifiedDate using PowerShell not equal to actual date in SharePoint Admin
I've created a report using PowerShell to get an overview of inactive SharePoint Sites using the LastContentModifiedDate property of the SharePoint object. But when I compare the date to...
WimVandierendonck
Feb 26, 2021Brass Contributor
Istvan Ybema
Apparently that date gets update by some kind of timer job.
You can find the correct date with the LastItemUserModifiedDate property of the web object.
$oWeb = Get-PnPWeb -Includes LastItemUserModifiedDate
$oContentModifiedDate = $oWeb.LastItemUserModifiedDate
- tcboeiraNov 28, 2023Brass ContributorWhat would this be like?
I mean... I looked for how to do it and in the end, via Powershell Script I used 'Get-PnPTenantSite'.
Basically it is:
...
$DaysInActive = 140
$SiteCollections = Get-PnPTenantSite
$Date = (Get-Date).AddDays(-$DaysInActive).ToString("MM/dd/yyyy")
$InActiveSites = $SiteCollections | Where {$_.LastContentModifiedDate -le $Date} | Select Title, Url, LastContentModifiedDate, Template, StorageMaximumLevel
$InActiveSites
...
And I always have the same impression. That the date is very close. How can it be done to obtain a more accurate date?