Posted on 11-13-2011 05:56 PM
I'm trying to create a URL which would take me to a given machine, or at least search for it in our JSS
I don't know how to find the computer_id on the machine itself, so I figure the next best thing is to have the url request a search in the JSS by serial # or MAC address.
Has anyone seen a sample URL which would run that search?
Thanks!
-Allen Hancock
--
Mac Consulting Group, Inc. - 225-933-5311 - Baton Rouge, Louisiana
Apple Support, Service, Sales, and Training http://macconsultinggroup.com/training
Posted on 11-13-2011 07:42 PM
Hi Allen,
It would be nice for a jamf binary verb to just spit out the computer ID
for various reasons like yours. Nice and quick. A feature request most
certainly.
However, what I've done for a long time now is a startup item package that
runs recon, writes out the computer ID it displays when it submits to the
jss to a local file. In theory this computer ID never changes in the JSS
so you can just reference that local file anytime you need to. I also
write out a local file that stores the proper computer for my system name
enforcement scripts.
I use the computer ID with a bunch of our lab maintenance scripts that use
curl commands to hit webpages. Again I use the computer ID as it is unique.
I'm sure there is a nice way to do this. Is this what you were looking for
somewhat?
You could certainly do a recon anytime you wanted to grab this ID, but
that's a waste.
Craig E
#!/bin/sh
. /etc/rc.common
#!/bin/sh
StartService ()
{
## Checking for valid Internet connection for maintenance"
/usr/sbin/jamf checkJSSConnection
## Delete an existing jss_computer_id.xml file if it already exists ConsoleMessage "Deleting existing jss_computer_id.xml" /bin/rm /private/var/jss_computer_id.xml
## Delete an existing computername.conf file if it already exists ConsoleMessage "Deleting existing cumputername.conf" /bin/rm /private/var/computername.conf
## Create local new computername.conf file
ConsoleMessage "Creating computername.conf file"
/usr/sbin/networksetup -getcomputername >
/private/var/computername.conf
## Update inventories
ConsoleMessage "Generating new jss_computer_id.xml"
/usr/sbin/jamf recon | grep '<computer_id>' >
'/private/var/jss_computer_id.xml'
return 0;
}
StopService ()
{
return 0;
}
RestartService ()
{
return 0;
}
RunService "$1"