forked from jamf/Jamf-Nation-Extension-Attributes
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApple Software Update - Automatically Download Updates.xml
34 lines (33 loc) · 1.32 KB
/
Apple Software Update - Automatically Download Updates.xml
1
<?xml version="1.0" encoding="UTF-8"?><extensionAttribute> <displayName>Apple Software Update - Automatically Download Updates</displayName> <displayInCategory>Security Reporting</displayInCategory> <dataType>string</dataType> <description>This attribute displays the status of the Apple software update option to "Automatically Download Updates". The value to be verified will need to be specified when creating this extension attribute. Example: "false" verifies that the setting is disabled. This extension attribute requires this preference be set using Managed Preferences (MCX).</description> <scriptContentsMac>#!/bin/shdesiredValue="EditFromTemplate_Desired_Value_-_Example:_false"currentUser=`last -1 -t console | awk '{print $1}'`appDomain="com.apple.SoftwareUpdate.ByHost"keyName="AutomaticDownload"result=""tmpResult="`dscl . mcxread /Users/$currentUser \"$appDomain\" \"$keyName\" |grep Value:| sed 's/Value\: //g'`"if [ "$tmpResult" == "1" ]; thenresult="true"elseif [ "$tmpResult" == "0" ]; then result="false"else if [ "$tmpResult" == "" ]; then result="Domain or Key Not Found" else result="$tmpResult" fififiif [ "$result" == "$desiredValue" ]; thenecho "<result>Pass ($result)</result>"elseecho "<result>Fail ($result)</result>"fi </scriptContentsMac></extensionAttribute>