Hi,
We have a script that takes a group of IOS devices and restart all devices in it. The part of the script that gets the iOS devices works but the restart part doesnt work.Any suggestions?
The script looks something like this:
#!/bin/sh
# Define Variables
### JAMF Pro username / password
apiUser="username"
apiPass="password"
### JAMF Pro URL
jssurl="jssname.jamfcloud.com"
### advanced mobile device search ID number
amds_id="10"
# Get Mobile Device IDs from advanced mobile device search. This will retreive all device IDs from advanced mobile device search id 1. Change the id # to retreive from different advanced mobile device search.
mobile_devices=`curl -ksu "$apiUser:$apiPass" -X GET "https://$jssurl/JSSResource/advancedmobiledevicesearches/id/$amds_id" -H "accept: application/xml" | xmllint --xpath "//mobile_devices/mobile_device/id" - | sed 's/</id>/
/g' | sed 's/<id>//g'`
for mobile_device in $mobile_devices
do
echo "Attempting to send a RestartDevice command to Mobile Device with ID: $mobile_device"
curl -ksu "$apiUser:$apiPass" -X POST "https://$jssurl:8443/JSSResource/mobiledevicecommands/command/RestartDevice/id/$mobile_device" -H "accept: application/xml"
done
exit