Can't Create a Custom Inventory Rule on a Mac on basis of a .plist value
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
...
CFBundleVersion
10.14.0
...
NSPrincipalClass
CUPSUFR2PrinterInfo
I would expect a new Custom Inventory Field to show up named "CUPSUFR2PrinterInfo10.14.0", but I never see it show up.
Thanks!
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.
Thanks!
5 Comments
[ + ] Show comments
Answers (1)
Answer Summary:
Please log in to answer
Posted by:
kentwest
6 years ago
FileExists(/Library/Printers/Canon/CUPS_Printer/Info/PrinterInfo.plugin/Contents/Info.plist)
But still, nada. - kentwest 6 years ago
The simple test works. Now, back to the more complicated test.... - kentwest 6 years ago
[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?! - kentwest 6 years ago
sudo /Library/Application\ Support/Quest/KACE/bin/KDeploy -custominventory
Password:
[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 - kentwest 6 years ago
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. - kentwest 6 years ago
https://support.quest.com/create-service-request
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. - Channeler 6 years ago
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. - kentwest 6 years ago
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!
Wha-a-a-ah?!!
When I ran this line earlier:
[PListValueReturn(/Library/Printers/Canon/CUPS_Printer/Info/PrinterInfo.plugin/Contents/Info.plist,CFBundleVersion,TEXT);]
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.
Arg!
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.) - kentwest 6 years ago
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? - chucksteel 6 years ago