/build/static/layout/Breadcrumb_cap_w.png

KACE Product Support Question


KACE Report to show size of particular folder

02/11/2019 505 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. 

1 Comment   [ + ] Show comment

Comments

  • Nico_K - Thanks for pulling this together. I was able to get this setup using your PowerShell command and I am able to see the info under the Custom Inventory Field for each system in Kace. However, there are 2 questions I have.

    1st - this is reporting but the user profiles are all listed with 0 for size. Perhaps I need to modify the command to display this correctly (see results below). Maybe I have an additional space or something.

    Command used: 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")

    Results:
    (CIR) Users Directory Size:
    Size [MB] FullName
    --------- --------
    0.00 C:\users\LSR
    0.00 C:\users\Public
    0.00 C:\users\jburke
    0.00 C:\users\Administrator
    0.00 C:\users\adm_jjb

    2nd, What I really need to know is the folder size of the user's Documents, Desktop and Pictures folders specifically (not the whole profile). We are planning to roll out Microsoft OneDrive KFM for backing up staff computers and we need to know in advance which staff has a lot of data that could cause bandwidth constraints at our 23 offices. The idea is to target staff with a large amount of data and ask them to run the setups to enable KFM (Known Folder Move) while they are at home vs the office.

    My PowerShell knowledge is limited and I think I should be able to just tweak your command a bit to get what I need. Company is looking to start this in the next week or two so this has become time-sensitive and I figured I would start with the folks at IT Ninja.

    Any suggestions would be much appreciated.

    Michael

All Answers

1

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.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share