Skip to main content

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

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

Thanks! I will give it a try.



Corbin


Thanks! I will give it a try.



Corbin


Thanks! I will give it a try.



Corbin


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

Jacob,



Thanks for the script, however we are just going to disable.



Corbin


@jacob_salmela That would return "Enabled" if the setting was set and then later disabled, wouldn't it?


@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.


Not using MCX or Profile manager. The script you provided works great!



Screenshot: http://note.io/1jxHKpL



Thanks!


@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.


Reply