02/11/2019 382 views

I am looking to make a report that will show a particular folder's size. I would be running this on a group of workstations and my goal is to see if how big this folder is for each user. I am not sure if this is possible but I would love some feedback on this. 

0 Comments   [ + ] Show comments


All Answers


Custom Inventory Rules are your friend:

1. create the CIR of your choice under Inventory|Software|New
ShellCommandTextReturn(powershell -command "$fso = new-object -com Scripting.FileSystemObject; gci -Directory c:\users\| select @{l='Size'; e={$fso.GetFolder($_.FullName).Size}},FullName | sort Size -Descending | ft @{l='Size [MB]'; e={'{0:N2}    ' -f ($_.Size / 1MB)}},FullName") (or whatever you use to get the nessesary info via CLI, this will show all user directories on a machine)

2. create a Report using this CIR.
You are done.

Answered 02/11/2019 by: Nico_K
Red Belt

  • Thank you for your feedback. I don't know if I understand this fully though. I made the CIR with your command but how do I go about using that to get info from devices? I am just a bit unsure on the reporting part of this.
    • the CIR is updated, when the system checks in.
      So it needs a bit time to get some info here.

      If you use the reporting wizard you have the possibility to use the CIR as field (you can find it under "Custom"), so you can have a report with these informations without much SQL knowledge.
      • I guess my question is how do I target devices with this custom inventory rule. In my case I am trying to get the size of a folder that merely holds some files and does not have any software attached to it. It currently shows it is deployed to 0 devices.
      • And in his script is "Fullname" supposed to be replaced with something?
  • Any help with my additional questions would be greatly appreciated
    • As stated before:
      You _CREATE_ a new Software Item, which is only used for the CustomInventoryRule.
      In already detected Software Items you are unable to modify the CIR.

      In this _NEWLY_CREATED_ SoftwareItem you enter the CIR to run the script or the test against a Registry Key or whatever.
      In our example it is a shiny little one liner (which you can modify to get what you want, feel free)

      Add all OS to this _NEWLY_CREATED_ SoftwareItem you want to run it to.

      Save it and let the appliance do the work during the check ins.
      You can find the info under Inventory|Devices| Software |Custom Inventory Fields.
      As soon as it is there it is also in the DB so a report against the CIR will show results.

      If you need someone to do all this for you, KACE Professional Services would be your first contact.