Disk and folder size trend logging ps script

BBA

Supreme [H]ardness
Joined
Apr 25, 2003
Messages
5,382
Anyone ever setup a power shell script to get disk and folder size and export results to a share for trend analysis over time?

I'm looking to set up trending for specific folders growth, once a month for several machines.

I am trying the get-foldersize script, not much luck getting the format I want, which is ovetall disk free space and folder root sizes. I don't care to log each folder or file in each path, just the overall total of space used in the root ofof specified application data paths.
 
Probably could append it to a CSV then easily graph that after you have enough data.
 
Linux has plenty of free tools for this sort of thing but on Windows you're probably going to have to go homebrew or pay for a software.
 
Looks like making a c# program to collect the data from the folders might work for me, then I'll figure out how to import it into my trend spreadsheet.
 
Read some examples from MS'es script repository and then modify to suit - these sort of reports are pretty standard stuff, so there are a lots of examples you can find that will point you in the right direction. Typically in a work situation I've done these sorts of reports via e-mail for trend analysis.

eg:
https://gallery.technet.microsoft.c...].Value=storage&f[2].Text=Storage&pageIndex=2

PowerShell Function to report folder sizes (Get-FolderSize):
https://gallery.technet.microsoft.com/scriptcenter/PowerShell-Function-to-6bebe734

...as a suggestion you probably want to handle drives and folders differently - eg: basic drive info can be found using the get-psdrive cmdlet, but I would tend to use get-foldersize for specific directories.
https://docs.microsoft.com/en-us/po...hell.management/get-psdrive?view=powershell-6

...it all depends on what how exactly you're trying to report it. filtering of output information is another consideration and can be done in multiple ways.
None of this requires the use of C# - but use whatever tools as you feel appropriate.
 
Back
Top