Hi @Justinas,
Currently I'm afraid it's impossible to retrieve last access date of files through PowerShell.
As a workaround, you can use the Get-PnPFile
cmdlet from the SharePoint PnP PowerShell module. This cmdlet provides the TimeLastModified
property, which represents the last time the file was modified or accessed. Here's an example command to retrieve the last access date of a file:
Connect-PnPOnline -Url https://yourtenant.sharepoint.com/sites/yoursite
$file = Get-PnPFile -Url "/sites/yoursite/Shared Documents/yourfile.docx"
$file.TimeLastModified
Also, you can go to Microsoft Purview >> Audit >> Specify a file name and search for file access records from the recent period to the current time.
If the answer is helpful, please click "Accept as Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.