/build/static/layout/Breadcrumb_cap_w.png

Custom Inventory Rules Querying values in plist files

Problem: 
I am trying to use the PlistValueEquals function in a Custom Inventory Rule to check the value of an item but it won't work properly. I believe the issue is being caused by the value being nested inside of a dictionary. The plist looks like this:
Dict {
RepeatingPowerOn = Dict {
time = 1200
weekdays = 8
eventtype = wakepoweron
}
}

When I try to check the value for time it does not return properly. Even when using PlistValueReturn(/Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist, time, NUMBER) to see what the value is I do not get anything back.

I have also tried PlistValueReturn(/Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist, RepeatingPowerOn, TEXT) and this returns the following:
Dict {
time = 1260
weekdays = 8
eventtype = wakepoweron
} [string]

Note that in the database the value appears as:
'Dict {<br/> time = 1260<br/> weekdays = 8<br/> eventtype = wakepoweron<br/>}'

However, this rule: 
PlistValueEquals(/Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist, RepeatingPowerOn, TEXT, Dict {<br/> time = 1260<br/> weekdays = 8<br/> eventtype = wakepoweron<br/>})
does not work to identify machines with those settings.

We are trying to detect the power on settings for the machines in our inventory so that we can deploy the settings that we would like to be in place.

Solution: 
By checking the syntax for the PlistBuddy command on macOS I found that you can query keys inside of a dictionary by using colons. The same syntax works for the Plist functions in custom inventory rules. Using that logic, this rule works:
PlistValueEquals(/Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist, :RepeatingPowerOn:weekdays, NUMBER, 8) and PlistValueEquals(/Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist, :RepeatingPowerOn:time, NUMBER, 1200) and PlistValueEquals(/Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist, :RepeatingPowerOn:eventtype, TEXT, wakepoweron)

Comments

This post is locked
 
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