Report for Total Hard Drive Space Usage

akaspar
akaspar Member Posts: 9

Hi everyone,

Testing new backup solutions and for cost calculation I'm trying to get an idea of how much data I have floating out there on the PCs SSD/HDD. Any chance someone has already created a report to check for that?

Comments

  • Russ
    Russ Member Posts: 29

    This sounds interesting… So you're saying a report of all used space on all fixed disks on all Windows Workstations? Is that right?

  • akaspar
    akaspar Member Posts: 9

    Yes sir. I found a community shared library script to report the free space, percentage and total disk size.

    Feels like a good start (needing subtract free space from the total space to get "used" space).

    However, I'm not exactly sure how to get the output of an Atera powershell script. Never done this before but I'm sure someone has or the script would be pretty useless. How are you doing it?

  • gilgi
    gilgi Administrator, Moderator, Internal Posts: 313 admin

    Might be pointing to the obvious, but there is a KB guide that might be useful for you
    https://support.atera.com/hc/en-us/articles/217754428-Run-Powershell-script

    let us know if you found how how to get the output log!

  • tanderson
    tanderson Member Posts: 279 ✭✭✭✭

    Paste this into Powershell:

    Get all fixed disks on the local machine

    $disks = Get-WmiObject -Class Win32_LogicalDisk -Filter "DriveType=3"

    Initialize an empty array to store the report

    $report = @()

    foreach ($disk in $disks) {
    # Create a custom object to store the disk information
    $diskInfo = [PSCustomObject]@{
    DriveLetter = $disk.DeviceID
    VolumeName = $disk.VolumeName
    UsedSpaceGB = "{0:N2}" -f (($disk.Size - $disk.FreeSpace) / 1GB)
    TotalSpaceGB = "{0:N2}" -f ($disk.Size / 1GB)
    FreeSpaceGB = "{0:N2}" -f ($disk.FreeSpace / 1GB)
    FreeSpacePct = "{0:N2}" -f (($disk.FreeSpace / $disk.Size) * 100)
    }
    # Add the disk information to the report array
    $report += $diskInfo
    }

    Display the report in PowerShell

    $report | Format-Table -AutoSize

  • akaspar
    akaspar Member Posts: 9

    Hi @tanderson Wow this works well. I can view the output by clicking View or if you miss it you can go to Admin > Users & Security > Audit Log and Recent Processes.

    Challenge is that each Device shows as a separate entry and there is no export button or option to see the output short of opening each one at a time.

    I guess I just need to figure out how to aggregate the outputs so I don't have to do this for all 200 devices.

  • Russ
    Russ Member Posts: 29

    Yes, running this across all Workstations and then aggregating it into a single report would be an excellent next step of improvement. Great job on that @tanderson

  • mbudke
    mbudke Member Posts: 137 ✭✭✭

    Nice script!
    Do you have a fileshare available from all computer so you can pipe the information in a file (e.g. excel?)
    Alternatively you can call a webhook from within the script to send the data and then use e.g. PowerAutomate to summarize it in a single file.

    Both is not a perfect solution but maybe better than viewing all 200 computer ;)

  • gilgi
    gilgi Administrator, Moderator, Internal Posts: 313 admin
  • akaspar
    akaspar Member Posts: 9
    edited August 15

    We have Egnyte which has an agent mounting a drive letter but those are just the user machines. I'm also trying to backup some industrial PCs that users don't log into.

    Maybe if the output gets put into CSV on C:\ for each machine there may be a way to pull all the files from each and dump them in a Sharepoint or something with Power Automate?

  • akaspar
    akaspar Member Posts: 9

    So for anyone interested the Atera chat support guided me to a report called "Audit Report" which contains many things but granular Disk Used space happens to be one of them. For all Agents at All clients. Ended up exporting to Excel and pulling what I needed for a one time thing.