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
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
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
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.
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)
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)
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)