I needed to display the ARDAgent version on a Mac the other day without sending anyone (else) in to the command line. Without any remote access I decided a quick Applescript would do the job. It’s very dirty, nothing more than a quick hack really… But it worked. Here’s the code in case you ever need to do the same.
1 2 3 4 5 6 7 | try set ardv to do shell script "cat /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/version.plist | awk '/CFBundleVersion/{getline;gsub(/[<string>|<\\/string>]/,\"\");gsub(/^[ ]+|[ ]+$/,\"\");print}'" display alert "ARDAgent found!" message "Version: " & ardv buttons "Quit" on error err display alert "ARDAgent Version failed." message err buttons "Quit" end try |
The interesting part is the cat piped in to awk. It’s a messy way of stripping out everything except the CFBundleVersion. It works. I didn’t say it was graceful!







