show hostname in Self Service? (macOS X)

dpratl
Contributor II

Hi all,

Is it possible to show the hostname in the Self Service?
I can create an Automater App or an Apple Script Policy for Self Service but it would be much better to see the hostname directly in Self Service.

Do you have any suggestions?

Thank you
BR
Daniel

12 REPLIES 12

tthurman
Contributor III

I'm not super proficient with it, but I'm sure you could create a Self Service Bundle that could grab information like that.

Regards,
TJ

dpratl
Contributor II

Hi @tthurman ,

Thank you for the fast response.

I forgot a little word (can) in my initial post ;)

You mean to create a Bundle so the user can click in Self Service on an icon an get the hostname displayed?
Yes that would be possible but I would like to have that information direct in Self Service so the user just has to open Self Service and can tell the Helpdesk the hostname.

BR
Daniel

millersc
Valued Contributor

In it's current form, this is not possible. As @tthurman said, you can make a bundle to give information like this. We have a bundle that when a user clicks it, will run a script, pull hostname, IP, AD Username and present in a pop-up using cocoaDialog. Helpful for Helpdesk folks and easy on end users.

But your idea sounds good and you should put a Feature Request in for it. Maybe something for v10.

dpratl
Contributor II

tthurman
Contributor III

@dpratl

I'm fairly certain a bundle would be solid for this.

On the left hand side, if you had the bundle enabled, you could just click it and it would show the information.

The user could open Self Service, Click the bundle (which is a tab on the left), see the host name (and possibly other information), and call the help desk.

Regards,
TJ

mm2270
Legendary Contributor III

@dpratt Another option, if you're open to using and deploying some small 3rd party utilities to your managed Macs, you could use one of them to put the hostname (and maybe some other stuff) right in the menubar for your users. There are several utilities out there that can do this for you, from free, to not free. Two free ones are Platypus and BitBar.
Platypus can create simple menubar "apps" that are invisible in the Dock when they're running, but show up in the menubar and can run a script when clicked on. Its good for simple menubar apps, but breaks down a bit when you start getting into complex scenarios or scripts that collect a lot of information.
BitBar is good for more advanced and customizable menubar items. Its something I use. BitBar can create some very involved/complex menubar items and doesn't have the same problem as Platypus once you get into the more involved stuff. It also uses a script of just about any kind to display the menu.

Both of these can also just display some text right in the menubar, visible all the time without needing to click on anything. Just wanted to put that out there as an option to consider.

dpratl
Contributor II

@tthurman A Self Service Plug-In would be a good possibility for that.
Do you have a link how I can create something like this?

@mm2270 I will take a look at those two programs, thank you. Honestly I would appreciate to do this with on board tools, but I will take a look :)

Thank you
BR
Daniel

mm2270
Legendary Contributor III

@dpratl I'm not sure what specific Plug-in creation method @tthurman had in mind, but as an experiment, I was able to whip something a bit wonky together to create a simple webpage that can be stored in /Users/Shared/, therefore accessible to all users on the Mac, that has a few basic lines of information in it. This in turn can be linked to a Self Service plug-in that points to the local file when clicked on, and shows the info right in Self Service.

While I did not do the next part yet, I would couple it with a simple LaunchAgent that ran periodically and also on network state changes that updated the html file by running a script to create/overwrite the local html file each time. That way the IP address and other potentially non-static data would get updated on a regular basis.
I'm sure there are better ways to do this, with things like javascript and such, where the webpage it loads can be more dynamic and generated on the fly each time the user clicks the Self Service plug-in within the html/javascript itself, rather than via an external script, but I don't know javascript and other web languages to be able to do this myself.

dpratl
Contributor II

@mm2270, that sounds good :)

I will try to create a script that creates such a html file, thank you. (I'm not a coder, but I try to find out)

BR
Daniel

cbrewer
Valued Contributor II

How about just putting the following jamfHelper script in your JSS and then having a Self Service policy that runs the script? (Not my original script).

#!/bin/sh

JHELPER="/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper"

USERNAME=$(ls -l /dev/console | awk '{print $3}')
MACNAME=$(scutil --get ComputerName)
PORT=$(/usr/sbin/netstat -rn -f inet | awk '/default/{print $NF; exit}')
IPADDRESS=$(ipconfig getifaddr $PORT)
MACADDRESS=$(networksetup -getmacaddress $PORT | awk '{print $3}')

MESSAGE="You are logged in as: $USERNAME
Computer name: $MACNAME
IP Address: $IPADDRESS
MAC Address: $MACADDRESS"

THEMESSAGE=$("$JHELPER" -windowType utility -title "System Information" -description "$MESSAGE" -button1 "OK" -button2 "Screenshot" -defaultButton 1 -icon "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericNetworkIcon.icns" -iconSize 64)

jmahlman
Valued Contributor

--deleted--

stevevalle
Contributor III

I have create a contextual menu to do this. I tried creating a Self Service Plug-In Bundle but I don't have much experience with Xcode so no luck there!

It's a simple right click on the Macintosh HD, select Services and Get Computer Name

a34aea4364604b64a94850bcb61d1bf9

Script added to Automator app:

appLocation="/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper"

popup="hud"
title="Computer Name"
heading="Your Computer Name is..."
description=$(scutil --get ComputerName)
button1="OK"
icon="/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/com.apple.led-cinema-display-24.icns"

"$appLocation" -windowType $popup -title "$title" -heading "$heading" -description "$description" -button1 "$button1" -icon "$icon"

Push out the workflow file via a policy.