Folder size - Simple!?

(imported topic written by ErinC91)

Hi all,

I’ve just recently started using BigFix and am still learning it’s use. (be gentle with me pls)

I want to run a relevance to check for the size of the MS Office 2003 Local Installation Source.

This folder is a hidden folder usually located at C:\MSOCache

I’ve searched this forum for ideas on how to achieve this and can’t seem to get anything to work through Q’n’A

The need for this has come about because I have found some of our PCs don’t have the entire Local Installation Source cached, and I’d like to know how many. Ideally, I need to check for the existence of 290 MB (304,396,814 bytes) worth of files in the “C:\MSOCache\All Users\90000409-6000-11D3-8CFE-0150048383C9” folder

Any help appreciated muchly, thanks.

Erin

(imported comment written by brolly3391)

Hello Erin and welcome,

Try:

q: sum of sizes of files of folder “C:\MSOCache\All Users\90000409-6000-11D3-8CFE-0150048383C9”

That will return the sum of sizes of files directly in that folder, without subdirectories.

If you need to include subdirectories then change files into descendants:

q: sum of sizes of descendants of folder “C:\MSOCache\All Users\90000409-6000-11D3-8CFE-0150048383C9”

Calling the descendants of a folder can be resource intensive. Check the evaluation time on that before using it in production.

One issue you will run into is if the folder does not exist, the relevance produces a

Singular expression refers to nonexistent object

error. You can account for that with an IF THEN ELSE.

q: if exists folder “C:\MSOCache\All Users\90000409-6000-11D3-8CFE-0150048383C9” then sum of sizes of descendants of folder “C:\MSOCache\All Users\90000409-6000-11D3-8CFE-0150048383C9” as string else “Missing Folder”

or if you prefer a boolean response:

q: if exists folder “C:\MSOCache\All Users\90000409-6000-11D3-8CFE-0150048383C9” then (sum of sizes of descendants of folder “C:\MSOCache\All Users\90000409-6000-11D3-8CFE-0150048383C9” = 304396814) as string else “Missing Folder”

The

as string

in there is to avoid the

Incompatible Types

error that occurs if the return variable of your THEN is different from the return type of your ELSE

Cheers,

Brolly

(imported comment written by Ahwilson)

Is there a simple way for the results to be sent to a file?

(imported comment written by ErinC91)

Wow, thanks for your time and effort brolly … it is much appreciated indeed.

I see where I was going wrong previously now. Thanks also for the explanation of the “as string” part, that does help clarify things.

I’m developing some monster tasks to clean up our domain of 4000+ PCs MS Office installations.

We have a mixture of different versions of 95,97, 2000 and 2002 and I need to remove them all and install 2003 … it’s been quite a mission I can tell you. I’m getting there though don’t be surprised if you see me post again soon :smiley:

Thanks again

(imported comment written by Edj)

Brolly,

I have found your answer useful in my task but I have discovered an issue. When I use the following example relevancy for the BufferDir, which the MAX default size is 3MB, an issue occurs.


(sum of sizes of files of folder (value “BufferDir” of key “HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\FillDB” of registry as string) as string > “3000000”)


Any size value with an increment that begins with a number lower than “3” will be considered smaller. Any size value with an increment that begins with a number higher than “3” will be considered larger.

ie: “20000000000000000000000” would be smaller while “4” would be larger.

Any ideas?

Thanks,

Edj

(imported comment written by brolly3391)

Hey Edj,

“20000000000000000000000” < "

but

20000000000000000000000 > 3

You will want to do that comparison as in integer, not as a string.

(sum of sizes of files of folder (value “BufferDir” of key “HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\FillDB” of registry as string) > 3000000)

Cheers,

Brolly

(imported comment written by Edj)

Brolly,

I also attempted the use the relevancy that you listed but it generated an error. I will give it another try.

(sum of sizes of files of folder (value “BufferDir” of key “HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\FillDB” of registry as string) > 3000000)

Thanks,

Ed

(imported comment written by Edj)

Brolly,

The error that I receive in the relevancy debugger is:

“Error: The operator “less than” is not defined.”

(imported comment written by brolly3391)

Heya Edj

That is interesting.

Please make sure you have the latest version of the relevance debugger.

http://support.bigfix.com/fixlet

I cut and pasted directly from the boards here and this is what I get in my debugger on my server. Not sure what is going on.

q: (sum of sizes of files of folder (value “BufferDir” of key “HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\FillDB” of registry as string) > 3000000)

A: False

T: 0.991 ms

I: singular boolean

q: (sum of sizes of files of folder (value “BufferDir” of key “HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\FillDB” of registry as string) > 3000000)

A: False

T: 2.785 ms

I: singular boolean

q: sum of sizes of files of folder (value “BufferDir” of key “HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Enterprise Server\FillDB” of registry as string)

A: 0

T: 0.376 ms

I: singular integer

Cheers,

Brolly

(imported comment written by Edj)

Brolly,

Got it. I didn’t remove the extra “as string” value.

Thanks,

Ed