Scripts run as root when executed via the JSS. This caused problems when trying to send notifications using terminal-notifier to users because root does not have a NotificationCenter instance, so any script using terminal-notifier would hang. The trick to get around that is to run the command as the user.
I have been converting a lot of my shell scripts over to Python as it is more flexible and powerful. This is script I wrote to send notifications while running as root.
It uses setuid to pose as the user and then uses the Casper parameters to customize the notification message. Tested on 10.9.