Custom Script for log-in Banner

saulv
New Contributor III

I see that there is a Log-In Banner setting in Jamf, but does anyone know of a simple script to customize the values seen below in Bold?

This Bob's School Mac is named 3NO21, has Asset Number 1618, and is
assigned to Bob John's 3rd Grade class. If found, please contact Bob's
School at xxx-xxx-xxxx

3 REPLIES 3

Hugonaut
Valued Contributor II

order up! Pretty sure this is what you're after! Happy to help.

once you've enrolled this computer & jamf has all the proper information (ie, the name you want & the asset tag), run this script.

https://github.com/Hugonauts/shellscripts/blob/master/JAMF%20API%20-%20Set%20Custom%20Login%20Messag...

#!/bin/bash

## Enter the API Username, API Password and JSS URL here
apiuser="apiuser"
apipass="apiuser"
jssURL="https://my.jss.company.com:8443"

## Get the Mac's UUID string
UUID=$(ioreg -rd1 -c IOPlatformExpertDevice | awk -F'"' '/IOPlatformUUID/{print $4}')

## Pull the Asset Tag by accessing the computer records "general" subsection
Asset_Tag=$(curl -H "Accept: text/xml" -sfku "${apiuser}:${apipass}" "${jssURL}/JSSResource/computers/udid/${UUID}/subset/general" | xmllint --format - 2>/dev/null | awk -F'>|<' '/<asset_tag>/{print $3}')

## Get Computers Name
Name=$(networksetup -getcomputername)

## Edit the raw text between the quotes below, do not edit ${Name} or ${Asset_Tag}.
loginWindowMessage="This Bob's School Mac is Named ${Name}, has Asset Number ${Asset_Tag}, and is assigned to Bob John's 3rd Grade Class. If found, please contact Bob's School at xxx-xxx-xxxx."

/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow.plist LoginwindowText -string "$loginWindowMessage"
________________
Looking for a Jamf Managed Service Provider? Look no further than Rocketman
________________


Virtual MacAdmins Monthly Meetup - First Friday, Every Month

saulv
New Contributor III

This was my first Request on JN. I am always hesitant to ask, because I don't want others to do my heavy lifting, but I find the sheer volume of information to weed through to be overwhelming, and I rarely find examples/answers that even come close to solve my issues. Plus, I'm new to a lot of this, so I'm doing my best, but I just run out of time and am exhausted from search after search.

Anyway, you're script worked EXACTLY how I wanted. Amazing, elegant and just so kind.

Thank you so very much.

Hugonaut
Valued Contributor II

Happy to help, You're welcome. Never hesitate to ask, this is what we're here for & this is an incredible community, you can learn a lot here. We've all started somewhere & I for sure know what its like to be in your shoes. A lot of people here are eager to help.

________________
Looking for a Jamf Managed Service Provider? Look no further than Rocketman
________________


Virtual MacAdmins Monthly Meetup - First Friday, Every Month