Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

File Scan & Size Report

This might be a bit of a strange task to accomplish completely in Inventory, but...

We have some computers that are 5+ years old that have seen daily use (8-5, 5 days a week, for the lifetime of the device). So, naturally there are a TON of temp files that have accumulated. Some that I've manually cleaned up lately have had 10-15GB of temp junk and once it's gone they typically leave the Low Free Space collections on their next scan and the users notice better performance, especially those with less powerful PCs or PCs that are shared with a group of users.

Setting up the File Scanner to look in a few different temp locations was easy, but I'm hoping I can make better use of the results.

My goal is to be able to total up the disk space taken up by the temp files, and have some collections OR a report built up to categorize them by how much space they use (say 2GB, 5GB, 10GB, Over 10 GB of temp files).

I'm not sure IF this is even possible, and if it is, how to best go about it?

Any help is much appreciated!

0

Comments

8 comments
Date Votes
  • I have an idea for how to do it with a SQL report, but it's going to be messy due to subfolders. I'll see if I can get it to do what I have in mind.

    0
  • Why not a Powershell script with a little bit of magic?

     

    My workflow idea: 

     

    Remote into PC --> Get-ChildItem on each of the Directories --> Grab TotalSize of Directory --> Logic to put into appropriate array for later processing --> Create Object(s) from Array(s) --> ConvertTo-HTML --> Send-MailMessage 

    0
  • Stephen - that would work, but I'm hoping to keep everything in Inventory as much as I can so I can quickly share reports with the other admins.

    Colby - SQL is ideal so I'm excited to see what you come up with! Messy doesn't matter if it works. ;)

    0
  • Ok, here's attempt #1. It shows the total size of all temp files per computer.

    SELECT
    Computers.Name as "Computer Name",
      ( SUM(Files.Size) / 1048576 ) AS "Temp File Aggregate MB"
    FROM
      Computers
    INNER JOIN
      Files ON Files.ComputerId = Computers.ComputerId
    INNER JOIN
    FilePaths ON FilePaths.FilePathId = Files.FilePathId
    WHERE
    <ComputerFilter>
    AND
    FilePaths.PathName LIKE '%temp%'
    GROUP BY
    Computers.Name
    0
  • Thanks, Colby. I have a little bit of tweaking to do for our particular environment and the file scans I set up but it's getting results. :)

    0
  • Maybe i sound a bit dumb but i have the same problem and i'm not into SQL. i really don't get how i can use this SQL report in PDQ. 

    0
  • 0
  • many thanks 

    0