6 Replies Latest reply on Mar 5, 2010 12:02 PM by jfaehnrich

    Adding Folder Size to Inventory






      We are in the preparatory stages of forcing a redirection of the local MyDocuments  folder for all domain clients to a nas. To get an idea



      of impact on storage I want to be able to report on the amount of data which is likely to be moved.



      What would be the best way to get the folder size for the MyDocuments folder for the Primary Owner of the device added to the inventory?












        • 1. Re: Adding Folder Size to Inventory


          I am looking at using the following vbs script to write a registry value which I can then collect using the custom data collection in the inventory;



          Set objNetwork = CreateObject("Wscript.Network")

          Set objShell = WScript.CreateObject("WScript.Shell")

          Set objFSO = CreateObject("Scripting.FileSystemObject")

          strUserName = objNetwork.UserName

          Set objFolder = objFSO.GetFolder("C:\DOCUMENTS AND sETTINGS\" &strUserName &"\my documents")

          objShell.RegWrite "HKCU\Software\intel\LANDesk\MyDocs",Int(objFolder.Size/1048576), "REG_DWORD"



          Any comments on whether you think this is the right way to go ?












          • 2. Re: Adding Folder Size to Inventory
            zman Master


            Do you have multiple profiles per machine? If so you, depending on how you run this it may overwrite the value. Also, depending on how you run this, it may not work since LANDesk may run it under the local system account.  So I suck in VB but maybe another spin on this is to transverse the entire doc and setting folder and calculate the aggregate size of all mydocs folders into one item. That way you can say this machine will have X amount of Gbs that will go to NAS.






            The next question is how to run this. I would think a custom vulnerability looking for the custom registry key set to autofix. 






            Just a thought, numerous ways to do this. 



            • 3. Re: Adding Folder Size to Inventory

              that will only work if you use ldms_client to gather it -- LANDesk native tools can't see into HKCU because they're running as localsystem (unless you manually wrap it with runasuser.exe). To use your script, you'll need to have it write into HKLM. As Dave points out, you then have to worry about reading it. Since the regkey reader in ldappl3.template isn't able to variable-ize the key, you'd need to write a string value concatenating username and folder size, which means you couldn't usefully query it. Alternatively, you could gather totals only.


              If you're willing to wait a bit (or hack together some perl) I can just add the feature to ldms_client. It would be a simple copy and modify of the PST file finder, and I could do per user folder size as well as total size. If you're not familiar with the tool, it's here.

              • 4. Re: Adding Folder Size to Inventory

                I've just posted a beta release of ldms_client that adds this feature. ldms_client_beta1.5.zip

                • 5. Re: Adding Folder Size to Inventory

                  Thanks Jack, I'll take a look and let you know how it works out.

                  Really appreciate the droppedpackets.org site, great stuff!



                  • 6. Re: Adding Folder Size to Inventory
                    jfaehnrich Rookie

                    I know this has been a dormant post for quite sometime, but after I look through the docs on the most current ldms_client release I still don't see how to capture 'My Documents' like the original post was requesting.  I'm in the same scenario that this thread was created for, but I'm having a hard time solving the problem of querying the appropriate folder, particularly since it's a dynamic path depending on which user you want to know about.  Jack, was there a reason you abandoned 'My Documents' and just maded it 'User Profile Size'?  Thanks for any help I receive.