Skip to main content
Question

Setting the asset tag to the match the computers name

  • June 13, 2018
  • 4 replies
  • 35 views

Forum|alt.badge.img+5

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

4 replies

Forum|alt.badge.img+11
  • Contributor
  • June 15, 2018

give this a try..

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


Forum|alt.badge.img+7
  • Contributor
  • February 13, 2020

Forum|alt.badge.img+18
  • Esteemed Contributor
  • February 13, 2020

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


Forum|alt.badge.img+18
  • Esteemed Contributor
  • February 23, 2022

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.