Apple - Notification Center message via AppleScript/osascript -- specify an application name and icon
I don't think it's possible with AppleScript but it is with terminal-notifier:
-sender ID The bundle identifier of the application that should be
shown as the sender, including its icon.
-appIcon URL The URL of a image to display instead of the application
icon (Mavericks+ only)
For example:
terminal-notifier -title title -message message -sender com.apple.TextEdit
You should be able to do
osascript -e 'tell app "System Events" to display notification "Finished that long running task." with title "Finally!"'
You can change "System Events"
to any other application name.
It seems you need to be root to make it show other icons than Apple Script. E.g. in a terminal window:
sudo osascript -e 'tell app "System Events" to display notification "Finished that long running task." with title "Finally!"'