Skip to main content
Question

Jamf Erase Device api command is locking devices instead

  • June 16, 2025
  • 1 reply
  • 3 views

Forum|alt.badge.img+4

Hi I've created this script utilizing the jamf API to wipe some 2015 intel MacBook Airs, but it's locking the devices instead of wiping them. I using the existing json format since the classic api's erase command has been deprecated. What am i running into here?

`

#!/bin/bash

# Define credentials
response=$(curl -v -u "GVC4_API_Admin_Migration:Change2025" https://gvc4.jamfcloud.com/api/v1/auth/token -X POST)
bearerToken=$(echo "$response" | jq -r '.token')

# Device IDs
computerIDs=(2403 2636 2619 2595)

for comID in "${computerIDs[@]}"
do
echo "Sending erase command to computer ID $comID..."
#curl -X POST \\
#-H "Accept: application/json" -H "Authorization: Bearer ${bearerToken}" \\
#"https://gvc4.jamfcloud.com/JSSResource/computercommands/command/EraseDevice/passcode/123456/id/$comID"
curl -X 'POST' \\
"https://gvc4.jamfcloud.com/api/v1/computer-inventory/$comID/erase" \\
-H "Authorization: Bearer $bearerToken" \\
-H "Content-Type: application/json" \\
-d '{ "pin": "123456" }'
done

`

 

1 reply

sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3536 replies
  • June 17, 2025

@gesiyeIgbas https://developer.jamf.com/jamf-pro/reference/createcomputercommandbycommandidandpasscode states that ErseDevice was deprecated on 2023-06-21 so that's probably why it becomes a DeviceLock.

You might want to take a look at https://learn.jamf.com/en-US/bundle/technical-articles/page/Erase_Device_Command_Options.html for the v2 endpoint which was updated 2024-09-02 and note the Obliteration Behavior option since Erase All Contents and Settings doesn't work on pre-T2 Macs like the 2015 MBAs.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings