Posted on 11-21-2022 08:18 AM
Hey all, we have had an issue where about 653 of our laptops didnt renew their MDM profile when it was expiring.
I'm now in process of re-enrolling them with the profiles renew -type enrollment command, however it prompts the end user to go a click install on their computer to complete the process. Since we had them approve the ability for applescript to do keystrokes and mouse clicks perviously, I am thinking I could script the click of the update button in notification center when it pops up.
I'm struggling to determine the UI element that is showing this button though. Does anyone have any clues to processing the click of the update button seen here? I always respect @mm2270 and their work, wondering if you have any idea if I can make it click this update button.
Solved! Go to Solution.
Posted on 11-21-2022 10:08 AM
The Jamf seal heal thing works great when the Jamf binary is broke. This is for the MDM Profile.
I don't think there is a way to GUI script notification acknowledgement. There are ways to script mouse clicks at a specific location - https://apple.stackexchange.com/questions/266784/how-do-i-make-the-mouse-click-at-current-location-u... gives a small idea.
11-21-2022 12:00 PM - edited 11-21-2022 12:20 PM
@KrisMallory Yea, the self healing is just for the framework not for mdm. If the mdm profile doesnt renew for some reason its a full re enrollment thats needed, but I think I found a way to automate this as much as possible.
@boberito Yea thanks, I was trying to tell it to use the UI info in the notifications box to click the update button, but if i keep it more generalized, it looks like I can make this work with just the coordinates.
If anyone else is looking for this after pushing a sudo profiles renew -type enrollment command just run this for a 13" MacBook Air:
#!/bin/bash
currentUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{print $3}')
profiles renew -type enrollment
sudo -u $currentUser osascript <<EOF
tell application "System Events"
delay 2
click at {1242, 96} -- {from left, from top}
click at {1242, 96} -- {from left, from top}
delay 2
click at {772, 366} -- {from left, from top}
end tell
EOF
Posted on 11-21-2022 09:28 AM
Check this out instead. We were able to repair a number of devices with the API.
https://www.modtitan.com/2022/02/jamf-binary-self-heal-with-jamf-api.html
Posted on 11-21-2022 10:08 AM
The Jamf seal heal thing works great when the Jamf binary is broke. This is for the MDM Profile.
I don't think there is a way to GUI script notification acknowledgement. There are ways to script mouse clicks at a specific location - https://apple.stackexchange.com/questions/266784/how-do-i-make-the-mouse-click-at-current-location-u... gives a small idea.
11-21-2022 12:00 PM - edited 11-21-2022 12:20 PM
@KrisMallory Yea, the self healing is just for the framework not for mdm. If the mdm profile doesnt renew for some reason its a full re enrollment thats needed, but I think I found a way to automate this as much as possible.
@boberito Yea thanks, I was trying to tell it to use the UI info in the notifications box to click the update button, but if i keep it more generalized, it looks like I can make this work with just the coordinates.
If anyone else is looking for this after pushing a sudo profiles renew -type enrollment command just run this for a 13" MacBook Air:
#!/bin/bash
currentUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{print $3}')
profiles renew -type enrollment
sudo -u $currentUser osascript <<EOF
tell application "System Events"
delay 2
click at {1242, 96} -- {from left, from top}
click at {1242, 96} -- {from left, from top}
delay 2
click at {772, 366} -- {from left, from top}
end tell
EOF
Posted on 11-21-2022 08:01 PM
I wonder if umad would detect this situation also and encourage the user towards clicking the option ?
https://github.com/macadmins/umad