Kaseya Community

TreeSize clone script

  • Hi All,

    I've created a Powershell script which is intended to be a clone of the TreeSize tool. It generates a size report of files and folders in a filesystem, presented as an interactive HTML file.

    I've also created an Agent procedure which can be used to schedule this report and upload to the Agent's file store. This is handy for historical comparison to see where disk usage has changed on a per-folder basis.

    The parameters of the script are maybe a little daunting, but there's only a couple of mandatory ones, and the default values for other parameters should suit just about everyone.

    To download the Powershell Script and the agent procedure, visit: https://github.com/jamesweakley/TreeSizeHtml 

    This github repository will be where I submit fixes/changes.

    Suggestions welcome!


  • Whoops, somehow I have posted this to the wrong forum. That's what happens when you try to multitask with too many browser tabs!

    Could a friendly moderator please move this to Scripts & Agent Procedures?

  • Hey Willis!

    That looks great.

    Which is PowerShell-Version is required? Is there any way to run it within WinXP-Clients?

  • Thanks Kai,

    Powershell V2 is required, so installing support.microsoft.com/.../968930 on any XP/2003 machines and it should work.

  • This is a great tool to give the techs.

    I found that quite a few stations will not run it, and I had to add a line to the script to enable it.

    At the top of the TreesizeHTML-All Fixed Drives script add:

    executePowershell(" ",set-executionpolicy -Scope Process -ExecutionPolicy RemoteSigned", false .....


    Bruce Orand

  • This seems to be broken in PowerShell 3.0 due to the ">" character not being allowed.

    Are you looking to make any changes? It's a great script!

  • hello, i have a problem to execute the PS script,

    TreeSizeHtml.ps1 : 119 Caractère : 19

    +           </div> < <<<< !-- /.select-menu-item -->

       + CategoryInfo          : ParserError: (<:OperatorToken) [], ParentContainsErrorRecordException

       + FullyQualifiedErrorId : RedirectionNotSupported

    have you any idea?

    cause i've upload your script without modifications



  • Hi all,

    I've just committed some changes to the help text format to give everyone a better chance of the script working out of the box.

    If you have any other issues of this nature let me know, and you should be able to work around them by deleting the help sections above the functions.

  • hi the treesize is no more extendable

  • Anyway that this could be fixed ?

    At the moment its just  a lot of text. It isnt expendable anymore.

    [edited by: axel101 at 4:09 AM (GMT -7) on Jun 13, 2014]
  • Hi guys.

    If the tree is not expanding anymore, it probably means that one of the externally hosted javascript files is not loading anymore.

    I committed this fix about 5 months ago due to the jquery script no longer being at the old URL:


    Unfortunately, reports generated by the script prior to this date have the old URL permanently stored. So to fix this you'd have to do a find/replace on the old files.



    needs to be replaced with this:


  • Keep getting:

    File C:\kworking\TreeSizeHtml.ps1 cannot be loaded because the execution of scr

    ipts is disabled on this system. Please see "get-help about_signing" for more d


    At line:1 char:2

    + . <<<< 'C:\kworking\TreeSizeHtml.ps1' -paths ALL -reportOutputFolder C:\kwork

    ing -zipOutputFilename DiskSpaceReport_2014_06_08.zip ;TreeSizeHtml

       + CategoryInfo          : NotSpecified: (:) [], PSSecurityException

       + FullyQualifiedErrorId : RuntimeException

    The term 'TreeSizeHtml' is not recognized as the name of a cmdlet, function, sc

    ript file, or operable program. Check the spelling of the name, or if a path wa

    s included, verify that the path is correct and try again.

    At line:1 char:139

    + .'C:\kworking\TreeSizeHtml.ps1' -paths ALL -reportOutputFolder C:\kworking -z

    ipOutputFilename DiskSpaceReport_2014_06_08.zip ;TreeSizeHtml <<<<

       + CategoryInfo          : ObjectNotFound: (TreeSizeHtml:String) [], Comman


       + FullyQualifiedErrorId : CommandNotFoundException

    Any help here's appreciated. Running this on 2008 and 2012 servers with no dice.

  • dagg929, you need to enable the execution of unsigned scripts for this to work.

    You can do it by running "set-executionpolicy RemoteSigned", or see Bruceorand's solution above to do it in the automation policy.

  • looks like the location of this library is no longer valid:


  • treesize_for_kaseya.zip

    I attached the zip file with the required files.  You'll have to upload jquery.treeview.js and jquery.treeview.css and the images folder to your own webserver.  You'll also have to modify the links in the powershell script.

    I also had to insert a 10 minute pause in the procedure, otherwise if it takes too long for all the drives it will just upload an empty zip file.

    edit: attached file
    [edited by: kuuser at 9:36 AM (GMT -7) on Aug 8, 2014]