Skip to main content
Solved

How to delete computer record from Terminal


mhasman
Forum|alt.badge.img+22
  • Valued Contributor
  • 426 replies

Hello,

I found some duplication in the inventory which looks like ghost record. It shows up in the list but never opens; and I am not able to delete it in JSS web interface.

Is there any easy way to delete computer inventory record via Terminal by ID #? Some command like:

sudo jamf delete_computer ID=XXX

Or should I deep down to MySQL?

Any suggestions are highly appreciated!

Best answer by ryan_ball

You would have to do this through the API OR you can still do this through the web interface if you want.

  1. Locate the computer record ID. You can find the ID in the URL when you view the computer record.
  2. Create an advanced search with the ID of the record that is messed up. Verify that the search results only return the correct record
  3. Click the "Action" button at the bottom of the search results, and choose to delete the computer
View original
Did this topic help you find an answer to your question?

7 replies

Forum|alt.badge.img+6
  • New Contributor
  • 67 replies
  • February 27, 2019

You would need to use the API to remove a computer record.

https://developer.jamf.com/apis/jamf-pro-api/index


Forum|alt.badge.img+18
  • Contributor
  • 475 replies
  • Answer
  • February 27, 2019

You would have to do this through the API OR you can still do this through the web interface if you want.

  1. Locate the computer record ID. You can find the ID in the URL when you view the computer record.
  2. Create an advanced search with the ID of the record that is messed up. Verify that the search results only return the correct record
  3. Click the "Action" button at the bottom of the search results, and choose to delete the computer

Forum|alt.badge.img+8
  • New Contributor
  • 59 replies
  • February 27, 2019

You could leverage the API, especially if you know the JSS ID's of the devices. Just made this quickly from another basic bash API script I had. There are a lot of ways to do it with Python as well.

You can find API documentation by adding "/api" to the end of your Jamf Pro server URL.

#!/bin/sh

apiUser="apiuser"
apiPass="apipass"
jssURL="https://myjamfurl.net:8443"

id="##"

curl -s -k -u "${apiUser}:${apiPass}" "${jssURL}/JSSResource/computers/id/$id" -X DELETE

mhasman
Forum|alt.badge.img+22
  • Author
  • Valued Contributor
  • 426 replies
  • February 27, 2019

Thank you all! I am going to try if works


Forum|alt.badge.img

As a follow up to this thread I've searched the Jamf Pro API reference at: https://www.jamf.com/developers/apis/jamf-pro/reference/ and https://www.jamf.com/developers/apis/classic/reference/#/ but did not find an option to remove a mobile device inventory. Is there any way to do this or if someone is able to point me in the right direction? Thanks.


Forum|alt.badge.img+5
  • Contributor
  • 11 replies
  • October 6, 2021
ryan_ball wrote:

You would have to do this through the API OR you can still do this through the web interface if you want.

  1. Locate the computer record ID. You can find the ID in the URL when you view the computer record.
  2. Create an advanced search with the ID of the record that is messed up. Verify that the search results only return the correct record
  3. Click the "Action" button at the bottom of the search results, and choose to delete the computer

cheers for that! have had a stuck record for months and kept getting flagged on reports - tried this and it worked brilliantly!


Jaykrishna1
Forum|alt.badge.img+7
  • Jamf Heroes
  • 80 replies
  • November 13, 2023
crbeck1 wrote:

You could leverage the API, especially if you know the JSS ID's of the devices. Just made this quickly from another basic bash API script I had. There are a lot of ways to do it with Python as well.

You can find API documentation by adding "/api" to the end of your Jamf Pro server URL.

#!/bin/sh

apiUser="apiuser"
apiPass="apipass"
jssURL="https://myjamfurl.net:8443"

id="##"

curl -s -k -u "${apiUser}:${apiPass}" "${jssURL}/JSSResource/computers/id/$id" -X DELETE

How can do this by ourself, if, we have around 50+ ghost records?


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