Powershell script to generate HTML report on files in given folders with specific extensions and size

11/03/2014 – v1.2

Added ‘Report run time’ at the bottom
Fixed bug when no files are found that match criteria
Turned into function
Bundled with EnhancvedHTML2
Added SizeUnit parameter

Screen output will look like:


The HTML report will look like:


A question was posted a few days ago on the Powershell.org Q&A forum:

I’m trying to get people to clean up old files. Never an easy job. To help them out, I want to generate reports of their department folders. One report would list their Powerpoint files, another PDFs and a third, zip files.

Many of us have been in this situation where data sprawl goes a bit out of control. This script helps produce HTML reports that can be customized to report on:

  • Files in several folders,
  • With specific file extensions,
  • Greater than a specific file size,
  • File properties reported on can also be customized

The script can be downloaded from the Microsoft Script Center Repository.

Sam Boutros (left) and Don Jones (right) - TechEd 2014 - Houston

Sam Boutros (left) and Don Jones (right) – TechEd 2014 – Houston

The script uses EnahncedHTML2 module which is written by Don Jones in 9/2013. I first met Don at TechEd 2014 in Houston where he delivered several sessions that I attended and enjoyed.  In spite of being one of the leading experts on Microsoft business technologies, he’s a down to earth guy who would take the time to answer a question or help out when needed.

To install EnhancedHTML2 module:

  1. Download it from the Powershell.org public OneDrive. Look under the Creating HTML Reports folder.
  2. Check your Powershell Module Path. Run $env:PSModulePath.Split(“;”) for example:ModPath
  3. Create a folder named “EnhancedHTML2” under any of the listed paths like c:\Program Files\WindowsPowerShell\Modules\EnhancedHTML2
  4. Copy the 2 files EnhancedHTML2.psd1 and EnhancedHTML2.psm1 to this folder (part of the downloaded files from #1 above)
  5. Finally run Import-Module EnahncedHTML2

2 responses

  1. david blum

    great script thanks, is there a way i could adapt it to display file sizes in MB rather than bytes ?

    November 3, 2014 at 2:33 am

  2. David, please see updated script version 1.2

    November 3, 2014 at 8:34 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.