Returning FileInfoReturn into a customer inventory field that might exist in multiple paths
I'm trying to return attributes of a executable file that will exist in different paths based on if the executable is on a 32 or 64 bit version of windows.
I've tried the following custom rules:
FileExists (C:\Program Files\CUSTOMAPP\Service\executable.exe) AND
FileInfoReturn(C:\Program Files\CUSTOMAPP\Service\executable.exe, size, NUMBER) OR
FileExists (C:\Program Files (x86)\CUSTOM APP\Service\executable.exe) AND
FileInfoReturn(C:\Program Files (x86)\CUSTOM APP\Service\executable.exe, size, NUMBER)
FileInfoReturn(C:\Program Files\CUSTOMAPP\Service\executable.exe, size, NUMBER) OR
FileInfoReturn(C:\Program Files (x86)\CUSTOM APP\Service\executable.exe, size, NUMBER)
No matter in the kdeploy always returns FALSE when the rule is executed.
[2019-04-02.15:59:16][KDeploy:CDeployController::Execu] rule [21157] statement result: "", FALSE
I can get the value to populate only when it's just the single FileInfoReturn function is used.
The Kace agent is version 9.0.270
-
Either create 2 custom inventory rules or adapt the answer by gerane from this post https://www.itninja.com/question/powershell-script-in-custom-inventory-rule - flip1001 5 years ago
Answers (1)
I have done this with ShellCommandTextReturn for reading a file's contents:
ShellCommandTextReturn(cmd /c type "c:\Program Files (x86)\Stata13\stata.lic") or
ShellCommandTextReturn(cmd /c type "c:\Program Files\Stata13\stata.lic")
And with MD5 (which might be a better way to differentiate in your case, too):
FileExistsWithMD5(C:\Program Files (x86)\IBM\SPSS\Statistics\25\stats.exe, 0f81795b72883f5edb8c0e1c436ad4cd) OR FileExistsWithMD5(C:\Program Files\IBM\SPSS\Statistics\25\stats.exe, 0f81795b72883f5edb8c0e1c436ad4cd)