Mac Admin: Grabbing AnyDesk identifiers and storing them in Mosyle.

Rather than going into AnyDesk and manually grabbing a users device identifier, we can just grab it direct from the system.conf file on a users device and throw it into Mosyle as a variable that can be looked up.

Here’s the code:

if [ ! -e "/private/etc/anydesk_ad_uniqueIDHere/system.conf" ]; then
    echo ""
else
    grep -E 'ad.anynet.alias' "/private/etc/anydesk_ad_uniqueIDHere/system.conf" | awk -F"ad.anynet.alias=" '{print $2}'
fi

Do a quick look to see what the unique code is for your Anydesk instance by installing it on your device first, doing an ls on the directory (so, ls /private/etc/), then replacing “uniqueIDHere” in the script with the instance code. It’ll be obvious when you see it.


Here’s what mine looks like:

alt text

And here’s the result once it runs:

alt text


I set it to execute on every mac startup and “Device Info” update.