Skip to main content

Recently joined a company whose computers don't have the asset tag field named, does anyone have a script to do this?



Really don't facing manually naming each one

give this a try..



https://www.jamf.com/jamf-nation/discussions/18944/setting-ard-info-fields-dynamically-from-the-jss


FWIW https://www.jamf.com/jamf-nation/discussions/27995/populate-computer-name-based-on-asset-tag-field


Since we use the barcode in the computer name which is like "Building-StaffPosition-Barcode or HS-Teacher12345" I do this:



#!/bin/sh

#1st get computer name#
COMPNAME=`/usr/sbin/scutil --get ComputerName`

#2-grab the last 5 characters#
vasset=${COMPNAME:(-5)}

#3-set the asset in JSS#
jamf recon -skipApps -skipFonts -skipPlugins -assetTag $vasset


Gabe Shackney
Princeton Public Schools


Id also say once you have the fleet enrolled with assigned asset tag info, I'd now just dump it into the PreInventory csv so it would automatically get it going forward without any needed scripting.


Reply