Posted on 03-24-2014 12:45 PM
My boss wants the infrared receiver disabled on all our Macs that support this feature.
Does anyone have an example of an extension attribute so I can scope the Macs to verify the that all of them get the infrared disabled.
Thanks!
Corbin
Solved! Go to Solution.
Posted on 03-24-2014 01:08 PM
This seems to do the trick for me.
#!/bin/bash
ir_check=$(/usr/bin/defaults read /Library/Preferences/com.apple.driver.AppleIRController|/usr/bin/grep DeviceEnabled|/usr/bin/awk '{print $3}')
if [[ "$ir_check" == "0;" ]]; then
echo "<result>Disabled</result>"
else
echo "<result>Enabled</result>"
fi
Posted on 03-24-2014 01:08 PM
This seems to do the trick for me.
#!/bin/bash
ir_check=$(/usr/bin/defaults read /Library/Preferences/com.apple.driver.AppleIRController|/usr/bin/grep DeviceEnabled|/usr/bin/awk '{print $3}')
if [[ "$ir_check" == "0;" ]]; then
echo "<result>Disabled</result>"
else
echo "<result>Enabled</result>"
fi
Posted on 03-24-2014 01:10 PM
Thanks! I will give it a try.
Corbin
Posted on 03-24-2014 01:10 PM
Thanks! I will give it a try.
Corbin
Posted on 03-24-2014 01:10 PM
Thanks! I will give it a try.
Corbin
Posted on 03-24-2014 01:20 PM
If the IR kext is completely removed, something like this might work:
#!/bin/bash
irStatus=$(kextstat -b com.apple.driver.AppleIRController | awk NR==2)
if [ -z "$irStatus" ];then
echo "<result>Disabled</result>"
else
echo "<result>Enabled</result>"
fi
Posted on 03-24-2014 01:26 PM
Jacob,
Thanks for the script, however we are just going to disable.
Corbin
Posted on 03-24-2014 01:34 PM
@jacob_salmela That would return "Enabled" if the setting was set and then later disabled, wouldn't it?
Posted on 03-24-2014 01:56 PM
@corbin3ci Now that i think about it, depending on how you plan to disable this preference, the EA script that i wrote might return incorrect info. If you set it with MCX, the preference in /Library/Preferences/ won't change. In other words, it will return as "Enabled" even tho you've disabled it using MCX or Profile Manger.
Posted on 03-24-2014 02:07 PM
Not using MCX or Profile manager. The script you provided works great!
Screenshot: http://note.io/1jxHKpL
Thanks!
Posted on 03-25-2014 04:16 AM
@denmoff Prior to running my script, I completely removed the IR extension:
srm -r /System/Library/Extensions/AppleIRController.kext
touch /System/Library/Extensions/
As far as I can tell, it returns the right values, but I did not do a lot of testing with it.