Hello,
Got an interesting issue where a script which deletes computers from JSS read from txt file via JSS API is working fine when executed from a mac, but not working when executed using a Babun bash shell on Windows Server 2016.
Now, when the file contains only 1 computer name - the script does work, but when several computer names on each string - it just skips through all the computers and does not delete any of them. Based on the output of the script (included the screenshot)
it looks like it captures the machine names from txt file correctly, on each string, yet it does not delete them, which is very weird and bizarre.
The script is pretty simple:
#!/bin/bash
# Delete computers from JSS based on the file with the list of computer names
jamfUsername="*********"
jamfPassword="*********"
jamfBaseURL="*********"
jamfComputerResource="JSSResource/computers"
computerList=`cat /file/path/ADtermedmachines.txt`
arr=($computerList)
for i in "${arr[@]}"; do
echo "Deleting computer: $i"
curl -H "Accept: application/xml" -sfku "$jamfUsername:$jamfPassword" "$jamfBaseURL/$jamfComputerResource/name/$i" -X DELETE
done
Anybody has any ideas what may be the issue? As the file is read correctly, the script is working, yet somehow it is not working with multiple computer names... Appreciate any ideas on this!