KACE Software Inventory Custom Rules
I'm trying to set a new "custom software" inventory rule that tests two conditions, one I have working just fine, the other is completely mystifying me. First rule checks the existence of a file, the second rule will check the "ModifiedDate" of that file and compare against known date. Here is the rule as I believe it should work (which doesn't)
FileExists(c:\fileexists.txt) AND FileInfoEquals(c:\fileexists.txt, ModifiedDate, DATE, 09/18/2013 14:03:10)
Documentation Syntax is: FileInfoEquals(fullpath, attribute, type, value)
I'm obviously missing something in my understanding, and the documentation hasn't helped me decipher anything. Trial and error has frustrated me to no end. Windows reports the Modified date as "Yesterday, September 18, 2013 2:03:10 PM" which I assumed should be 09/18/2013 14:03:10.
Documentation says: "DATE must be in the format of MM/dd/yyyy HH:mm:ss. For example: 09/28/2006
05:03:51. Time is required."
So, what am I missing?
Answers (1)
Can you check what time stamp do you get when you run the command
FileInfoReturn(c:\fileexists.txt, ModifiedDate, DATE)
See if the seconds matches
Comments:
-
FileInfoReturn is not a DOS command. It some sort of program scriptlett used by KACE that returns an attribute that is used (piped to) by another. I am not sure how to grab that info directly, otherwise I would have.
Do you have a suggestion on how to get that return value out of the system for someone that knows almost nothing about programming? :-D - archangel michael 11 years ago-
create a temp custom software inv that uses that command provided by AbhayR to get the return in the kbox
FileInfoReturn(c:\fileexists.txt, ModifiedDate, DATE) - SMal.tmcc 11 years ago
-
This is the return value:
9/18/2013 14:03:10 [date]
I think I see the issue. Leading 0 on the Month. I'll see if that fixes it. Update to follow - Heading into a staff meeting so it will be tomorrow before I can followup. - archangel michael 11 years ago -
Still no love. Set up Custom Inventory Rule with single parameter as follows.
FileInfoEquals(c:\fileexists.txt, ModifiedDate, DATE, 9/18/2013 14:03:10)
Previous Custom Inventory rule to return value still shows up as "9/18/2013 14:03:10 [date]"
So, the file exists, returns a date of "9/18/2013 14:03:10" and the test against the date returns negative.
FYI, this is why I am not a programmer. GRRRR - archangel michael 11 years ago-
I've tried with and without the leading 0 on the date field. Neither work. - archangel michael 11 years ago
-
Are you saying that you get "9/18/2013 14:03:10" with
FileInfoReturn(c:\fileexists.txt, ModifiedDate, DATE)
and
FileInfoEquals(c:\fileexists.txt, ModifiedDate, DATE, 9/18/2013 14:03:10) doesn't work ? - AbhayR 11 years ago-
That is what I am saying. With or without leading 0 on the date field. - archangel michael 11 years ago
-
-
KACE version v5.4.76847, Dell KACE Agent (5.4.10622) - archangel michael 11 years ago
-
I am puzzled as to why its not working for you. It works for me.
Try running
FileExists(c:\Program Files\Dell\KACE\AMPAgent.exe) AND FileInfoEquals(c:\Program Files\Dell\KACE\AMPAgent.exe, ModifiedDate, DATE, 02/08/2011 22:38:56)
with the date you get from FileInfoReturn command below.
FileInfoReturn(c:\Program Files\Dell\KACE\AMPAgent.exe, ModifiedDate, DATE)
Also, go to c:\Programdata\Dell\Kace or c:\Documents and Settings\All Users\Dell\KACE directory and check Kdeploy.log and paste the log from the time when you run this rule - AbhayR 11 years ago-
Here is the exact EVERYTHING, Copy/Paste, without any obfuscation of any sort ... {Curly Braces = results}
Custom Inventory Rule Background Info
FileExists(c:\Background.bgi) {works}
Custom Inventory Rule BGINFO
FileInfoReturn(c:\Background.bgi, ModifiedDate, DATE) - { returns "1) BGINFO: 9/18/2013 14:03:10 [date]" as the Software / Custom Inventory Fields section}
Custom Inventory Rule BGINFO-Date-test
FileInfoEquals(c:\Background.bgi, ModifiedDate, DATE, 9/18/2013 14:03:10) {fails}
LOG from Recent attempt
[Wed Sep 25 11:53:24 2013] [CDeployController::ExecuteCustomInventoryRule] statement result: ;21468, TRUE
[Wed Sep 25 11:53:24 2013] [CDeployController::ExecuteCustomInventoryRule] statement result: ;21541:MDkvMTgvMjAxMyAyMTowMzoxMA==%DATE, TRUE
[Wed Sep 25 11:53:24 2013] [CDeployController::ExecuteCustomInventoryRule] statement result: "", FALSE - archangel michael 11 years ago
-
Please give a space after the value of the date at the end
FileInfoEquals(c:\Background.bgi, ModifiedDate, DATE, 9/18/2013 14:03:10 ) - AbhayR 11 years ago-
[Wed Sep 25 12:18:50 2013] [CDeployController::ExecuteCustomInventoryRule] statement result: ;21468, TRUE
[Wed Sep 25 12:18:50 2013] [CDeployController::ExecuteCustomInventoryRule] statement result: ;21541:MDkvMTgvMjAxMyAyMTowMzoxMA==%DATE, TRUE
[Wed Sep 25 12:18:50 2013] [CDeployController::ExecuteCustomInventoryRule] statement result: "", FALSE
No Luck. Returns False - archangel michael 11 years ago
-
Ok. Here is what the problem might be.
Agent is comparing the time in GMT and not in local time zone. Please convert the time reported on server to GMT
Ex: 9/18/2013 14:03:10 will become 9/18/2013 21:03:10 (if you are in PST )
and then run the rule - AbhayR 11 years ago-
[Wed Sep 25 12:35:54 2013] [CDeployController::ExecuteCustomInventoryRule] statement result: ;21468, TRUE
[Wed Sep 25 12:35:54 2013] [CDeployController::ExecuteCustomInventoryRule] statement result: ;21541:MDkvMTgvMjAxMyAyMTowMzoxMA==%DATE, TRUE
[Wed Sep 25 12:35:54 2013] [CDeployController::ExecuteCustomInventoryRule] statement result: "", FALSE
No dice. Thanks for the suggests so far. - archangel michael 11 years ago
-
Ok. Run the command
C:\Program Files\Dell\KACE\AMPTools.exe set debug=true
and then run the rule and see what is the date reported in the log for FileInfoReturn() and use the same date in the rule - AbhayR 11 years ago-
Ran it twice, with different time stamps based on output. The date was because the other Custom Software rule returned value (snippet below)
[Wed Sep 25 12:54:52 2013] [OUT] 09/18/2013 21:03:10
Both resulted "false" result. the double quotes thing is interesting inclusion in the result. Not something I would expected of a Boolean question. Relevant snippets below.
[Wed Sep 25 12:54:52 2013] [CDeployController::ExecuteCustomInventoryRule] issuing rule [FileInfoEquals(c:\Background.bgi, ModifiedDate, DATE, 9/18/2013 14:03:10 );]
[Wed Sep 25 12:54:52 2013] [CDeployController::ExecuteCustomInventoryRule] statement result: "", FALSE
[Wed Sep 25 12:57:18 2013] [CDeployController::ExecuteCustomInventoryRule] issuing rule [FileInfoEquals(c:\Background.bgi, ModifiedDate, DATE, 09/18/2013 21:03:10);]
[Wed Sep 25 12:57:18 2013] [CDeployController::ExecuteCustomInventoryRule] statement result: "", FALSE
Again, thanks for the help. I am learning, even if we aren't solving the problem. Which happens to be the best way for me to learn. So thanks! - archangel michael 11 years ago
-
What is the output date in log when you run the FileInfoReturn CI rule? - AbhayR 11 years ago
-
[Wed Sep 25 12:54:52 2013] [OUT] 09/18/2013 21:03:10
I included it above. It is reporting GMT. Which is why I ran it both with Local and GMT time. I'm wondering if it is because we are on PDT rather than PST. If that is the case, then the whole thing is a bust, because we change times twice a year, and the hell if I am going to change the software library rule twice a year.
The thing of it is, I do have a work around for this case, but it is not as elegant as this is. I could check against the file name only, and change that with each version.
c:\Background.bgi ... to ... c:\Background1.bgi
I just wish the date function worked like it seems like it should. (In other words, I'm about to give up on it working at all). - archangel michael 11 years ago
-
Sorry, I had a 5.5 agent version on my machine where it is working. You were right, it doesn't work on 5.4 agent version and seems to be a bug.
Since, this bug is addressed in 5.5, I would recommend upgrading to 5.5. - AbhayR 11 years ago