In the process of moving computers from current Production JSS to new JSS. We're not migrating, we're re-enrolling to start clean. The move is easy, but I'm trying to clean up my old JSS as they migrate.
I figured an easy way to do this would be through the API, but I've not used API for anything yet, and am scratching my head as to what is failing. My script is below.
#!/bin/bash
name=`scutil --get HostName`
curl -X DELETE -u jamfadmin:password https://jsstest.org.com:8443/JSSResource/computers/id/$name
exit 0
My output seams to show that it's not grabbing the host name as expected but I'm not sure why. I'm sure it's blatantly obvious, but for the life of me, I'm not seeing it.
sh --verbose API Delete.sh
#!/bin/bash
name=`scutil --get HostName`
scutil --get HostName
curl -X DELETE -u jamfadmin:password https://jsstest.org.com:8443/JSSResource/computers/id/$name
<html>
<head>
<title>Status page</title>
</head>
<body style="font-family: sans-serif;">
<p style="font-size: 1.2em;font-weight: bold;margin: 1em 0px;">Not Found</p>
<p>The server has not found anything matching the request URI</p>
<p>You can get technical details <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">here</a>.<br>
Please continue your visit at our <a href="/">home page</a>.
</p>
</body>
</html>
exit 0