Tag Archives: powershell file report

File Report PowerShell Function

Function Get-FileReport
Function Get-FileReport

Get-FileReport function creates detailed file report and exports it into CSV format.


Use this function to export properties for files of certain type (doc, txt, jpg, etc.), and files older than certain days. The report includes the following file properties:
File Name | Full File Path | File Extension | File Size in KB | File Owner | Last Change Date | Computer Name
To use the Get-FileReport functions you can dot source the ps1 file in the PowerShell console:
.  .\Get-FileReport.ps1
or in your profile:

Dot Source Function in Profile
Dot Source PowerShell Function in Profile – Type dot and the full path to the ps1 file.

A comment based help is included. Use Get-Help Get-FileReport -full to retrieve the details bellow.


  • Path
    Specifies the target folder path. Scans the files recursively.
  • Days
    Defines the file age.
  • Ext
    Specifies the file extension.
  • Export
    Exports the results in CSV file. Specifies the folder path for the export file.


Returns the properties of all files under c:\backups.

Returns all files under c:\backups older than 1500 days:

File_Name        : Rmtshare.exe
Full_File_Path   : C:\backups\Rmtshare.exe
File_Extension   : .exe
File_Size_(KB)   : 12.77
File_Owner       : DOMAIN\user
Last_Change_Date : 02/19/1999
Computer_Name    : COMPUTER03

Returns all .txt files under c:\backups older than 150 days:

File_Name        : temp.txt
Full_File_Path   : C:\backups\temp_files\temp.txt
File_Extension   : .txt
File_Size_(KB)   : 0.01
File_Owner       : DOMAIN\user
Last_Change_Date : 02/19/2013
Computer_Name    : COMPUTER03

Exports to CSV all .txt files under c:\backups older than 150 days:

File_Name Full_File_Path File_Extension File_Size_(KB) File_Owner Last_Change_Date Computer_Name
commands.txt C:\backups\commands.txt .txt 0.09 DOMAIN\User 2/21/2013 COMPUTER03
filer_backup.txt C:\backups\filers\filer_backup.txt .txt 0.06 DOMAIN\User 3/12/2013 COMPUTER03
remapping_drive.txt C:\backups\documents\remapping_drive.txt .txt 0.85 DOMAIN\User 9/12/2013 COMPUTER03


You can use (Get-Help Get-FileReport).Examples from the console to retrieve the examples.

The Code: