Need help trying to unassign User and Location for computers

Medinao
New Contributor

Currently we use this script to assign whatever user logs into their laptop it reaches out to jamf and assigns the student to that specific computer.

 

#!/bin/bash

lastUser=`defaults read /Library/Preferences/com.apple.loginwindow lastUserName`
jamf recon -endUsername $lastUser

 

 Now I want to see if it is possible to blank out the user that is assigned to that computer instead of going to each computer and editing each student out for the new school year.

I have tried to see if this script would work but not thing seems to work.

 

#!/bin/bash

# Set the user details to blank using Jamf commands
/usr/local/bin/jamf recon -username " "
/usr/local/bin/jamf recon -realname " "
/usr/local/bin/jamf recon -email " "
/usr/local/bin/jamf recon -department " "

 

 Please help as I know there must be a solution out there.

1 REPLY 1

AJPinto
Honored Contributor II

API would probably be the best way to go. The general work flow is you would export a spreadsheet of the devices you need to update. Write a script to call JAMF API to clear that information (set blank values), and loop the command for each computer/device in the spreadsheet. Section 3 of the JAMF 300 training goes over API, Section 3 Lesson 15 covers loops.

 

Jamf Pro API Overview

Lesson 15 - Course Resources | Jamf