Add Extension Attribute to Check the Parental Control Status

Steven_Xu
Contributor
Contributor

Here are two scripts can be used to create the extension attribute to check the Parental Control status on Client, take it if you need. I'm not good at coding, but they work.

  1. #!/bin/sh
    find /Library/Managed Preferences/*/ -name "com.apple.familycontrols.logging.plist" > /tmp/pc.txt
    FILE=find /Library/Managed Preferences/*/ -name "com.apple.familycontrols.logging.plist" -print -quit
    if [ -f "$FILE" ]; then
    USERS=cut -d"/" -f4 /tmp/pc.txt
    echo "<result>Enabled on Users: $USERS</result>" 
    else
    echo "<result>Not Enabled</result>"
    fi
  2. #!/bin/sh
    USERS=dscl . -readall /Users MCXSettings | awk -v RS="-" '{for (i=NF; i>=2; i--) if ($i ~ /RecordName:/ && $(i-1) != 0 )  print $(i+1) }'
    if [ "$USERS" ]; then
    echo "<result>Enabled on Users: $USERS</result>" 
    else
    echo "<result>Not Enabled</result>"
    fi
0 REPLIES 0