KACE Product Support Question

Can't Create a Custom Inventory Rule on a Mac on basis of a .plist value

05/23/2018 879 views
I'm trying to create a Custom Inventory Rule (and I don't know what I'm doing) to create a Custom Inventory Field consisting of two fields from a .plist file.

On the SMA I go to Inventory / Software / Choose Action / New, and give it a name ("CIR - Canon UFRII Driver v. 10.14.00") and a version number ("10.14.00") and a Publisher ("Canon"), and then I put the following into the Custom Inventory Rule box:

PListValueReturn(/Library/Printers/Canon/CUPS_Printer/Info/PrinterInfo.plugin/Contents/Info.plist,NSPrincipalClass,TEXT) AND PListValueReturn(/Library/Printers/Canon/CUPS_Printer/Info/PrinterInfo.plugin/Contents/Info.plist,CFBundleVersion,TEXT)

I specify the Category as "Driver" and hit "Save".

When I do a "Force Inventory" on the Mac, the CIR never shows up. What am I doing wrong?

Here are the relevant portions of that .plist file:

ACU14090:Application Support westk$ cd /Library/Printers/Canon/CUPS_Printer/Info/PrinterInfo.plugin/Contents/
ACU14090:Contents westk$ cat Info.plist

I would expect a new Custom Inventory Field to show up named "CUPSUFR2PrinterInfo10.14.0", but I never see it show up.

Answer Summary:
5 Comments   [ + ] Show comments


  • As a test, I simplified my Custom Inventory Rule to simply searching for the existence of a file:


    But still, nada.
    • Once again, I'm an idiot; when I was swapping out my real test for this simple test, I looked away for a moment as I was copy/pasting the original to a safe place, and wound up putting this simpler test in the "Notes" field instead of into the "Custom Inventory Rule" field. D'oh!

      The simple test works. Now, back to the more complicated test....
  • Okay, I just found this in ".../data/user/KAgent.log":

    [2018-05-23.11:10:27][KDeploy:ExecuteCustomInventoryRu] rule ID [140233] : issuing rule [PListValueReturn(/Library/Printers/Canon/CUPS_Printer/Info/PrinterInfo.plugin/Contents/Info.plist,CFBundleVersion,TEXT);]
    [2018-05-23.11:10:27][KDeploy:ExecuteCustomInventoryRu] rule [140233] statement result: "", FALSE
    [2018-05-23.11:10:27][KDeploy:RunCustomInventory ] KDeploy finished processing 1 custominventory rules, sending response

    "False"?! Wha-a-a-a?!
    • I don't have a MAC handy to test... but try reaching support, to rule out a possible defect reading PList
  • Well, at least I've learned how to test my setup more quickly:

    sudo /Library/Application\ Support/Quest/KACE/bin/KDeploy -custominventory

    [2018-05-23.16:50:48][KDeploy:main ] KDeploy ----- Starting KDeploy.exe -----
    [2018-05-23.16:50:48][KDeploy:main ] KDeploy called with params: -custominventory
    [2018-05-23.16:50:48][KDeploy:main ] KDeploy starting custominventory
    [2018-05-23.16:50:48][KDeploy:SendServerMsg ] KDeploy Contacting server OOB: https://k1000.acu.edu/service/kbservice.php?request=GetCustomInventoryRules
    [2018-05-23.16:50:48][KDeploy:SendServerMsg ] KDeploy SendServerMsg starting curl call
    [2018-05-23.16:50:48][KDeploy:SendServerMsg ] KDeploy SendServerMsg returned from curl call
    [2018-05-23.16:50:48][KDeploy:SendServerMsg ] KDeploy good PB return - Received custom inventory rules (1)
    [2018-05-23.16:50:48][KDeploy:RunCustomInventory ] KDeploy custominventory processing 1 rules
    [2018-05-23.16:50:48][KDeploy:ExecuteCustomInventoryRu] rule ID [140233] : issuing rule [PlistValueReturn(/Library/Printers/Canon/CUPS_Printer/Info/PrinterInfo.plugin/Contents/Info.plist,1:CFBundleVersion,TEXT);]
    Print: Entry, ":1:CFBundleVersion", Does Not Exist
    [2018-05-23.21:50:48][KDeploy:ExecuteCustomInventoryRu] rule [140233] statement result: "", FALSE
    [2018-05-23.21:50:48][KDeploy:RunCustomInventory ] KDeploy finished processing 1 custominventory rules, sending response
    [2018-05-23.21:50:48][KDeploy:RunCustomInventory ] KDeploy sending response: []
    [2018-05-23.21:50:48][KDeploy:SendServerMsg ] KDeploy Contacting server OOB: https://k1000.acu.edu/service/kbservice.php?request=HereisCustomInventoryResults
    [2018-05-23.21:50:48][KDeploy:SendServerMsg ] KDeploy SendServerMsg starting curl call
    [2018-05-23.21:50:48][KDeploy:SendServerMsg ] KDeploy SendServerMsg returned from curl call
    [2018-05-23.21:50:48][KDeploy:main ] KDeploy finished custominventory
  • Well, I've tried Chat three times with KACE today; the second time, after not paying attention for 60 seconds after 28 minutes of waiting, Saul answered, and then gave up on me after that 60 seconds. The first time apparently timed out; the third time I timed out, being frustrated with waiting.

    So I thought, "Hey, I'll use the EXACT example they use in the 8.0 Admin Guide (https://support.quest.com/technical-documents/kace-sma/8.0/administrator-guide/138#TOPIC-829263):

    PlistValueReturn(~/Library/Preferences/GlobalPreferences.plist, AppleLocale, TEXT)

    and it also returns:

    PlistValueReturn(~/Library/Preferences/GlobalPreferences.plist, AppleLocale, TEXT)

    (I also tried the global plist, starting at "/Library", with the same result.)

    It would appear that this feature does not work.
    • Mmmmm... Try to submit the case via

      Make sure you select "KACE Systems Management Appliance" as the Product.

      I would say ask for the timeout, maybe it's a defect and we are chasing ghosts troubleshooting. Submit it there and they will reach you.
    • Going home yesterday I began to wonder if maybe that .plist file may not even exist, so this morning I was able to check, and no, there is no "GlobalPreferences.plist" anywhere that I can find. So of course the example doesn't work....

      So I'll try it with "/Library/Preferences/org.cups.printers.plist"; it's a plain ASCII file, and probably exists on every Mac system.

      So my new Custom Inventory Rule is this:

      PlistValueReturn(/Library/Preferences/org.cups.printers.plist, 1:printer-name, TEXT)

      and ... <drum roll> ...

      It worked!

      Okay, making progress.

      The CIR has "1:printer-name", because the "printer-name" key is in several <dict> sections, so I have to specify which <dict> section I'm looking at. (Counting begins at zero apparently, so "1" is really the second printer listed in this file.) I don't know how I'd check for this value if I didn't already know details about this particular file (which <dict> in what order) that I wouldn't generally know, but at least I've proven that the process works. Now all I have to do is get it to work on the file I'm actually trying to parse.
      • Perms on both the "org.cups.printers.plist" and "Info.plist" file are 644.

        I've gone back to my original test, with this CIR:

        PlistValueReturn(/Library/Printers/Canon/CUPS_Printer/Info/PrinterInfo.plugin/Contents/Info.plist,0:CFBundleVersion, TEXT)

        I added in the "0:" because it's in a <dict> section, but it's the only <dict> section.

        The result still fails:

        [2018-05-24.08:07:24][KDeploy:ExecuteCustomInventoryRu] rule ID [140233] : issuing rule [PlistValueReturn(/Library/Printers/Canon/CUPS_Printer/Info/PrinterInfo.plugin/Contents/Info.plist,0:CFBundleVersion, TEXT);]
        Print: Entry, ":0:CFBundleVersion", Does Not Exist
        [2018-05-24.13:07:24][KDeploy:ExecuteCustomInventoryRu] rule [140233] statement result: "", FALSE

        but I do notice that using "0:" (or "1:", as earlier, before I realized the counting starts at zero) results in a "Does not Exist" error, which does not occur if I don't include that piece.

        So I remove the "0:", to return it to my original CIR:

        PlistValueReturn(/Library/Printers/Canon/CUPS_Printer/Info/PrinterInfo.plugin/Contents/Info.plist,CFBundleVersion, TEXT)

        and run that, and lo and behold, *it* works!


        When I ran this line earlier:


        it failed.

        Now it works. The only difference I can see is the non-capitalized "L" in "PlistValueReturn". Surely that's not been the problem?

        So I tried it again, with an upper-case. It failed.

        Then again, with a lower-case. It worked.


        And sure enough, the 6.3, 7.2, and 8.0 Admin Guides have it as "PlistValueReturn", lower-case.

        So, one final test, with both of my Custom Inventory Rules:

        PlistValueReturn(/Library/Printers/Canon/CUPS_Printer/Info/PrinterInfo.plugin/Contents/Info.plist,NSPrincipalClass,TEXT) AND PlistValueReturn(/Library/Printers/Canon/CUPS_Printer/Info/PrinterInfo.plugin/Contents/Info.plist,CFBundleVersion, TEXT)

        (making sure to lower-case the "L"), and...

        It works!

        Custom Inventory Fields (1)
        1) CIR - Get Canon UFRII Driver version: CUPSUFR2PrinterInfo AND 10.14.0 [string]

        (I didn't expect the " AND " to be in the string, but i can live with that.)
  • I have two CIRs that use PlistValueReturn that work successfully:
    PlistValueReturn(/Applications/Microsoft Word.app/Contents/Info.plist, CFBundleVersion, TEXT)
    PlistValueReturn(/Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist, RepeatingPowerOn, TEXT)

    Maybe try one of those to see if they work?

    What version of client/server are you using?

Answer Chosen by the Author

The problem turns out that I was using "PListValueReturn" instead of "PlistValueReturn" (notice the non-upper-cased "L" in the one that works).
Answered 05/24/2018 by: kentwest
Brown Belt

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ