Shell Script to put info in "Computer Info" for ARD

robby_barnes
New Contributor III

Hello,

I am wondering if someone has an idea of a script or something that would allow me to make all managed computers in the JSS show something in the "Computer Info" section of ARD. I have tried creating some settings changes with composer, but have not had it work on any test machines yet.

Essentially what I would like to do is have it say something like "JSS Managed" in the computer info field when I'm scanning all of my networks with ARD, so at a glance I can tell which machines are managed and which ones aren't. It may be something that we even put the JSS version in to, so that we can change it every time it gets updated, and quickly look through ARD and figure out which computers have not updated themselves yet.

Any ideas?

1 ACCEPTED SOLUTION

mm2270
Legendary Contributor III

http://ss64.com/osx/kickstart.html
Take a look specifically at the "-configure -computerinfo -set1 -1 text" etc. lines.

View solution in original post

6 REPLIES 6

mm2270
Legendary Contributor III

http://ss64.com/osx/kickstart.html
Take a look specifically at the "-configure -computerinfo -set1 -1 text" etc. lines.

ooshnoo
Valued Contributor

There are extension attributes already created so you can collect this information

https://jamfnation.jamfsoftware.com/extensionAttributes.html

mm2270
Legendary Contributor III

@ooshnoo - it seems that @robby.barnes was asking about how to set those fields, not necessarily on how to collect the info in the JSS, although its true there are existing EA templates to gather the data. Still, it needs to be set before it can be collected.

I should also mention that you can set those fields up as part of a Casper Imaging configuration if my memory serves me. Meaning, going forward, just set the string you want in each of your configs and when Macs get imaged and enrolled, it will already be there. OTOH, if you have systems getting enrolled that were not imaged, you'd still need to script it to plug that info in on those Macs.

robby_barnes
New Contributor III

Correct. I am trying to write that field, not read it.

I'll play around with the info on that site here today and let you know what I find. It's easy to do going forward, there are several ways to do that. I just recently purchased the JSS suite, and we're implementing it in an environment with about 700 computers spread out across the country. At this point I'm just trying to clean up and organize everything that we already have. We're good on computers going forward.

Thanks!

robby_barnes
New Contributor III

That had some great resources.

Using that I wrote:

#!/bin/bash

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -computerinfo -set1 -1 "Whatever you want"

And it works great! Thanks guys!

rhysforrester
New Contributor

I run the below script once a week via a policy - it lets me bounce my test classroom back and forth between my prod and dev environments without worrying about the ARD field ever having incorrect data...and log data always helps.

#!/bin/bash
kick=/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart
field=`/usr/bin/defaults read /Library/Preferences/com.apple.RemoteDesktop Text1`
jss=`/usr/sbin/jamf checkJSSConnection | sed -e 's/:*//' | awk -F "/" '{print $3}'`
log=/usr/bin/logger

if [ -z $field ]; then
  $log "[INFO] ARD field 1 is blank, setting as: $jss"
  $kick -configure -computerinfo -set1 -1 "$jss"
else
  if [ $jss != $field ]; then
    $log "[INFO] ARD field ($field) differs from the JSS ($jss) managing this Mac, setting new server name"
    $kick -configure -computerinfo -set1 -1 "$jss"
  fi
fi