top of page

PowerShell - Get all Stale File Dates by UNC Recursive

  • Writer: Jon Boyette
    Jon Boyette
  • Jan 11, 2022
  • 1 min read

Save as GetNTFSPermissions.ps1, or named.ps1, when ran provide the \\computer\share and -recursive, this will step through the entire share and output the last time ALL files were accessed to C:\temp\UNCOldfiles.csv

#Enter in the path to search for.

#Using the 'Recurse' switch will search through all sub-directories as well.

$Path = Read-Host "Enter UNC path to determine stale files/folders, use -recurse to list all child items"

#Searching for directories that haven't been updated in 6 Months.

Get-ChildItem -Path $Path -Recurse -Directory | Where-Object {($_.LastWriteTime -lt (Get-Date).AddMonths(-6) )} | select FullName, LastWriteTime | Export-Csv C:\temp\UNCOldfiles.csv -NoTypeInformation


 
 
 

Recent Posts

See All
PowerShell - List All Domain SPNs

Save as same List_ALL_SPNs.ps1 or similar, this LDap calls the Domain for all Service Principal names and accounts related #Build LDAP...

 
 
 
PowerShell - Start-Monitoring

This is a great script used to Monitor and Email if a server is up or down, once ran, and smtp and from address is set, then run:...

 
 
 

Comments


Post: Blog2 Post
  • Facebook
  • Twitter
  • LinkedIn

©2022 by Boyette Technical Services. Proudly created with Wix.com

bottom of page