I am attempting to use the method referenced below to cleanup my wwwrootbes\uploads folder. It worked great in my test environment, but in production it is returning:
Error: Singular expression refers to nonexistent object.
This error occurs after 31 seconds running. Does it fail because there is too much data? Does it time out?
Do you know how to modify the session relevance to limit it to a given number of files in the uploads directory? I have played with it but havenât found an answer.
items 1 of it whose (item 0 of it = item 0 of item 1 of it) of ((elements of ((set of unique values of (tuple string item 0 of it as lowercase) of values of results of property 1 of bes fixlets whose (name of it is "BigFix Server - Uploads Directory - Windows")) - (set of (it as lowercase) of unique values of parenthesized parts 2 of (matches (regex "(\:|%22)([0-9a-fA-F]{40})( |%22)") of it) of (scripts of actions of bes fixlets;action scripts of bes actions;scripts of actions of components of component groups of bes baselines;action scripts of member actions of bes actions;(values of shared variables of it; values of private variables of it) of bes wizards) ))), (tuple string item 0 of it, tuple string item 1 of it) of values of results of property 1 of bes fixlets whose (name of it is "BigFix Server - Uploads Directory - Windows"))
@strawgate willbe able to confirm what is wrong but I found that taking the last tuple string item 1 of it and making that tuple string item 0 of it, I got a list of sha1âs without the actual file names, so something has changed somewhere since it was initially writtenâŚ
Throwing just
(tuple string item 0 of it,tuple string item 1 of it) of values of results of property 1 of bes fixlets whose (name of it is âBigFix Server - Uploads Directory - Windowsâ)
at the session relevance fails with the same Singular expression refers to a non existent object.
That worked! I ran the session relevance below, as you suggested, and it completed. Then I used web reports to output the results of the property âBES Server - Uploads with the File Names - Windowsâ. Then I put the results of the presentation debugger and web report in a spreadsheet and did a vlookup to associate the sha1 with a name. Now I have 4000 folders to delete. I wonder why over 600 of those folders are empty?
items 1 of it whose (item 0 of it = item 0 of item 1 of it) of ((elements of ((set of unique values of (tuple string item 0 of it as lowercase) of values of results of property 1 of bes fixlets whose (name of it is "BigFix Server - Uploads Directory - Windows")) - (set of (it as lowercase) of unique values of parenthesized parts 2 of (matches (regex "(\:|%22)([0-9a-fA-F]{40})( |%22)") of it) of (scripts of actions of bes fixlets;action scripts of bes actions;scripts of actions of components of component groups of bes baselines;action scripts of member actions of bes actions; (values of shared variables of it; values of private variables of it) of bes wizards)))) , (tuple string item 0 of it, tuple string item 0 of it) of values of results of property 1 of bes fixlets whose (name of it is "BigFix Server - Uploads Directory - Windows"))
If you are using the OS Deployment or the Software Distribution features, and have properly configured the BES Server Plugin Service and the Uploads Maintenance tasks associated with OSD or SWD, there is a scheduled process that deletes uploaded OSD or SWD packages when their associated content is removed through their dashboards. I expect the Uploads Maintenance may delete the files while leaving the folders behind, but that shouldnât cause any problems. Just an explanation for one possible reason to have empty folders left behind.
Here is updated session relevance from L3 that appears to work better than the relevance above. It finds more obsolete packages, and it displays the package name. I have no idea why it displays more packages. I would like to know. It has something to do with case.
items 1 of it whose (item 0 of it = item 0 of item 1 of it) of
(
(elements of ((set of unique values of (tuple string item 0 of it as lowercase) of values of results of property 1 of bes fixlets whose (name of it is "BigFix Server - Uploads Directory - Windows")) - (set of (it as lowercase) of unique values of parenthesized parts 2 of (matches (regex "(\:|%22)([0-9a-fA-F]{40})( |%22)") of it) of (scripts of actions of bes fixlets;action scripts of bes actions;scripts of actions of components of component groups of bes baselines;action scripts of member actions of bes actions;(values of shared variables of it; values of private variables of it) of bes wizards) ))), (tuple string item 0 of it as lowercase, tuple string item 1 of it | "NoFileFound") of values of results of property 1 of bes fixlets whose (name of it is "BigFix Server - Uploads Directory - Windows"))
Donât forget you need the analysis created by Strawgate.
@strawgate, Iâm interested in trying out this process to clean up my uploads folder. I found the necessary analysis on BigFix.me, but it said i need to request access. I did that yesterday, under the same ID I use here on the forum. I hate to bug you about it, but my need is kind of time-sensitive. Would you be able to grant me access to that analysis? Thanks!
I couldnât find where youâre storing the session relevance for the regex used in this comparison, but I wanted to suggest a tweak to it, to match a string starting with â=â as used in the âadd prefetch itemâ syntax
set of unique values of parenthesized parts 2 of (matches (regex "(\:|%22|=)([0-9a-fA-F]{40})( |%22)") of it) of (scripts of actions of bes fixlets;action scripts of bes actions;scripts of actions of components of component groups of bes baselines;action scripts of member actions of bes actions;(values of shared variables of it; values of private variables of it) of bes wizards)