Policy check os version failing

enidazhapa
New Contributor

Hi there,

We have deployed a policy in JSS which checks the OSX version and if it is < 10.11.2 then a prompt appears on the user's computer. The user has the option to either click on 'Help' which will point to a URL or to click on 'Okay' which will open 'App Store' on Updates section. The issue we seem to have is that for all the computers that are 10.11.1 or older there is an error in the policy log and the policy fails.

--10.11.1 Version--
Script result: 2016-11-28 09:25:21: System returned 10.11.1
2016-11-28 09:25:21: Outdated version, prompting OS version check dialogue
02016-11-28 09:25:27: User clicked 'Okay' opening App Store to updates section
2016-11-28 09:25:27.398 osascript[1363:26096] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
2016-11-28 09:25:27.398 osascript[1363:26096] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
2016-11-28 09:25:27.399 osascript[1363:26096] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
2016-11-28 09:25:27.401 osascript[1363:26096] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
29:37: execution error: App Store got an error: Application isn’t running. (-600)

--10.10.5 Version--
2016-11-28 09:59:37: Outdated version, prompting OS version check dialogue
02016-11-28 09:59:40: User clicked 'Okay' opening App Store to updates section
110:142: execution error: An error of type -10810 has occurred. (-10810)
Script result: 2016-11-28 10:03:43: System returned 10.10.5
2016-11-28 10:03:43: Outdated version, prompting OS version check dialogue
02016-11-28 11:05:51: User clicked 'Okay' opening App Store to updates section
29:37: execution error: App Store got an error: Application isn’t running. (-600)

When we run the script manually on the computer it works but when pushed through JSS it gives the above errors.

Also, once the 'osascript' part of the script has been commented the policy will complete, which makes me believe that it's the osascript that makes the policy to fail. This is weird as if the osascript part is executed manually on the terminal it runs fine.

This is the osascript which opens up App Store/Updates section:

osascript -e "tell application "App Store"" -e "activate" -e "delay 1" -e "tell application "System Events" to tell process "App Store" to keystroke "5" using command down" -e "end tell"

Your assistance in this issue is much appreciated.

Thanks,
Enida

1 REPLY 1

karthikeyan_mac
Valued Contributor

Hi,

Try adding sudo -u $(ls -l /dev/console | awk '{print $3}') open /Applications/App Store.app when opening App Store. This happens since the JAMF policy opens the GUI in root console.

Thanks & Regards,
Karthikeyan