If you don't want it to auto close, remove the "giving up after 4". It will close the message after 4 seconds and start the policy. Otherwise, it won't install until user click OK. You can increase the number.
OSASCRIPT="/usr/bin/osascript"
"$OSASCRIPT" -e 'display dialog "Installing Citrix Workspace" buttons {"OK"} default button 1 giving up after 4'
jamf policy -event CustomEvent
If you don't want it to auto close, remove the "giving up after 4". It will close the message after 4 seconds and start the policy. Otherwise, it won't install until user click OK. You can increase the number.
OSASCRIPT="/usr/bin/osascript"
"$OSASCRIPT" -e 'display dialog "Installing Citrix Workspace" buttons {"OK"} default button 1 giving up after 4'
jamf policy -event CustomEvent
So i can do this in the same policy and have the script happen before the install of the ,pkg? Or do I have to make a separate policy? if I have to make the install separate, how do i link the two polices?
So i can do this in the same policy and have the script happen before the install of the ,pkg? Or do I have to make a separate policy? if I have to make the install separate, how do i link the two polices?
We have a pop-up message policy which trigger the app installing policy. So, yes, 2 policies. The app policies are set to "Ongoing", so you need to trigger it. We don't use it that much since most of the apps update automatically.
#!/bin/sh
## Parameters for new software version
appPath="$4" # /Applications/Microsoft\\ Excel.app
appName="$5" # Microsoft Excel
newVersion="$6" # 16.55.21111400
policyTrigger="$7" # installExcel
OSASCRIPT="/usr/bin/osascript"
## Check installed version
version=$(defaults read $appPath/Contents/Info CFBundleShortVersionString)
if [[ $version != $newVersion ]]; then
$OSASCRIPT -e 'display dialog "'"$appName"' is outdated. Please quit '"$appName"', then click OK to update." buttons {"OK"} default button 1'; killall $appName; jamf policy -event $policyTrigger
fi
exit 0

We have a pop-up message policy which trigger the app installing policy. So, yes, 2 policies. The app policies are set to "Ongoing", so you need to trigger it. We don't use it that much since most of the apps update automatically.
#!/bin/sh
## Parameters for new software version
appPath="$4" # /Applications/Microsoft\\ Excel.app
appName="$5" # Microsoft Excel
newVersion="$6" # 16.55.21111400
policyTrigger="$7" # installExcel
OSASCRIPT="/usr/bin/osascript"
## Check installed version
version=$(defaults read $appPath/Contents/Info CFBundleShortVersionString)
if [[ $version != $newVersion ]]; then
$OSASCRIPT -e 'display dialog "'"$appName"' is outdated. Please quit '"$appName"', then click OK to update." buttons {"OK"} default button 1'; killall $appName; jamf policy -event $policyTrigger
fi
exit 0

Well, this hasn't worked quite like I wanted it to.
I created a script, called z_distributionNotify
#!/bin/sh
## Parameters for new software version
appPath="$4" # Path to application /Applications/Microsoft\\ Excel.app
appName="$5" # Name of App Microsoft Excel
newVersion="$6" # target App Version 16.55.21111400
policyTrigger="$7" # name of install policy to be triggeredinstallExcel
OSASCRIPT="/usr/bin/osascript"
## Check installed version
version=$(defaults read $appPath/Contents/Info CFBundleShortVersionString)
if [[ $version != $newVersion ]]; then
$OSASCRIPT -e 'display dialog "'"$appName"' is outdated. Please quit '"$appName"', then click OK to update." buttons {"OK"} default button 1'; killall $appName; jamf policy -event $policyTrigger
fi
exit 0
It is called by the policy z_update Workspace Notify. It is set to be Recurring Check-in, Once Per Computer, Automatically re-run, on next occuring check-in. it passes the following arguments into the script z_distributionNotify 
z_update Workspace Notify is supposed to call the policy z_updateWorkspace2206 which installs the actual update I'm trying to install nicely. However, when z_update Workspace Notify runs, i get the following error message:
Executing Policy z_update Workspace Notify
Running script z_distributionNotify...
Script exit code: 0
Script result: 2022-06-22 16:03:21.167 defaults[9762:175867]
The domain/default pair of (/Applications/Citrix\\, Workspace.app/Contents/Info) does not exist
2022-06-22 16:03:21.449 osascript[9763:175870] -[__NSCFConstantString objectAtIndex:]: unrecognized selector sent to instance 0x7fff8be230d0
2022-06-22 16:03:21.450 osascript[9763:175870] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString objectAtIndex:]: unrecognized selector sent to instance 0x7fff8be230d0'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff345ee4d7 __exceptionPreprocess + 250
1 libobjc.A.dylib 0x00007fff6ceb25bf objc_exception_throw + 48
2 CoreFoundation 0x00007fff3466d607 -[NSObject(NSObject) __retain_OA] + 0
3 CoreFoundation 0x00007fff34552d2b ___forwarding___ + 1427
4 CoreFoundation 0x00007fff34552708 _CF_forwarding_prep_0 + 120
5 CoreFoundation 0x00007fff34521ef7 CFArrayContainsValue + 197
6 HIServices 0x00007fff328287b9 TransformProcessType + 927
7 osascript 0x000000010856902c osascript + 12332
8 HIToolbox 0x00007fff3323c7a5 AEInteractWithUser + 53
9 StandardAdditions 0x000000010b12a8b9 CSDSTEXTurl_ + 5865
10 StandardAdditions 0x000000010b11b331 AEVTsysodlog + 85
11 AE 0x00007fff358e6203 _AppleEventsCheckInAppWithBlock + 18103
12 AE 0x00007fff358f5c83 AESendMessage + 2838
13 AE 0x00007fff35901fb1 aeSend + 355
14 osascript 0x0000000108567b25 osascript + 6949
15 AppleScript 0x00007fff480b9fb2 _Z13ComponentSendPK6AEDescPS_ii + 485
16 AppleScript 0x00007fff480cbb7a _ZN15TUASApplication4SendEP25TStackFrame_UASRemoteSendP6AEDescS3_hhh + 2332
17 AppleScript 0x00007fff480ec917 _Z13UASRemoteSendhhhhhPh + 548
18 AppleScript 0x00007fff480c4e60 _Z13UASActor_Sendhhh + 383
19 AppleScript 0x00007fff480f8072 _Z13UASValue_Sendhh14TUASClassIndexh + 326
20 AppleScript 0x00007fff480cfc69 _Z11UASExecute1v + 288
21 AppleScript 0x00007fff480a3796 _Z14ASExecuteEventPK6AEDescjiPj + 614
22 AppleScript 0x00007fff4809c5e1 AppleScriptComponent + 1677
23 AppleScript 0x00007fff480b584b _ZN12AGenericCall8DelegateEP23ComponentInstanceRecord + 37
24 AppleScript 0x00007fff480b5811 _ZN15AGenericManager13HandleOSACallEP19ComponentParameters + 57
25 AppleScript 0x00007fff480b4dfc GenericComponent + 156
26 OpenScripting 0x00007fff3347f3e2 OSAExecuteEvent + 50
27 osascript 0x00000001085685bd osascript + 9661
28 libdyld.dylib 0x00007fff6e05acc9 start + 1
29 ??? 0x0000000000000003 0x0 + 3
)
libc++abi.dylib: terminating with uncaught exception of type NSException
/Library/Application Support/JAMF/tmp/z_distributionNotify: line 17: 9763 Abort trap: 6 $OSASCRIPT -e 'display dialog "'"$appName"' is outdated. Please quit '"$appName"', then click OK to update." buttons {"OK"} default button 1'
No matching processes were found
Checking for policies triggered by "z_updateWorkspace2206" for user "jssaccount"...
No policies were found for the "z_updateWorkspace2206" trigger.
i'm less concerned about the popup message not working. I need to know why my notify script isn't finding my update script. Someone please help
I created a notifyScript , a notifyPolicy, and a updatePolicy.
notifyPolicy is set to enabled, recurring check-in, automatically rerun, on next.
notifyPolicy passes the name updatePolicy into notifyScript
notifyScript uses updatePolicy name as a custom event trigger to call update Policy
When notifyPolicy runs, i get the following:
"No policies were found for the "updatePolicy" trigger.
Where am i going wrong?