Powershell Script to report on file usage

Posted on 2012-08-14
Last Modified: 2012-08-20
Hello, I need a powershell script to run against a mapped drive that will list large file, file not been accessed in over 12 months, and when the file was created please.

I am unable to install FSRM onto the server :(
Question by:infradatel

    Author Comment

    Oh and I need to include all folders and subfolders please.
    LVL 13

    Accepted Solution

    Hi mate,

    Will list files that aren't modified in more than 12 months
    $compareDate = (Get-Date).AddMonths(-12)
    Get-ChildItem C:\Temp -Recurse | Where-Object { $_.LastWriteTime -lt $compareDate }

    Open in new window

    Will list the largest.
    Get-ChildItem C:\Temp -Recurse | Sort-Object -Descending Length | Select -First 1

    Open in new window

    Show the creationdate
    Get-ChildItem C:\Temp -Recurse | select Creationtime, Length, Name

    Open in new window

    LVL 9

    Expert Comment

    I would just export everything then you can filter in Excel much easier than running multiple PowerShell filters. PowerShell makes things easier at times, but also can make things take longer if you don't use it wisely :9

    Author Closing Comment

    Great thanks, sorry for the delay been away

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    This article will show, step by step, how to integrate R code into a R Sweave document
    In this previous article (, we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now