Does anyone know how to successfully change then capture the changes made to the Notifications pane in System Preferences so I can then push the settings to end users?
I would like to change the Management Action from Banners to Alerts so the notifications I push to the users have to be manually dismissed by the user. Currently with the banner alerts users only have a couple of seconds to read the alert unless they open up notification center which they don't generally use.
Many thanks in advance.
@corbin3ci][/url - yes, but it involves using an app like terminal-notifier and a script. Or, if you're on version 9 of the JSS, you may be able to leverage the Management Action.app from a policy. I'm not clear on how easy it is to use the Notification Center feature in 9 just to send out notifications, but it should be possible
Edit: Also, I'm almost certain that these settings for Notification Center are stored in a SQLite db, under both 10.8 and 10.9. They aren't that easy to manipulate or push out as a result.
From Item #11 of the "11 Things You Might Not Know About the Casper Suite" presentation at JNUC 2013:
/Library/Application Support/JAMF/bin/Management Action.app/Contents/MacOS/Management Action -title "You win" -subtitle "Thank you #JNUC" -message "That is a wrap"
Of course, you could also use cocoaDialog instead of using Notification Center.
I'd also like to change the default from banner to alert also as that way the user has a better chance of seeing the message but also can dismiss it in their own time compared to the 5sec delay currently.
i'm sure there is a way to do a sqlite change for this kinda stuff like it's done for setting the default wallpaper since apple moved away from the .plist for that setting....
Hi @jserapio - you might also want to take a look at cocoaDialog version 3.x. It specifically has a window type called "notify" that, under version 3 uses an embedded version of Growl to send up small bubble notifications on the screen. In its default behavior the "bubble" window is black with white text, which isn't the nicest look to me, but the advantage is it can accept quite a bit of text without getting cut off. The bubble window expands vertically to whatever size is needed to show the text.
You can also turn off the new Growl like functionality and use the older style bubbles, which lets you specify the exact background, text and border colors to use with hex values, but then you lose the auto window expansion, so its a trade off.
Let me know if you decide to look at that and need some help with it.
We did find a way to extend the "Banner" dialog box (see below). You can set the duration it sticks (which by default is approximately 5 seconds) to however long you want. Just a click on it anywhere closes it.
defaults write com.apple.notificationcenterui bannerTime SECONDS
The downside, however, is that this is a global setting for ALL banners. So we're still on a hunt to find a way to change the setting from "Banner" to "Alert" - the best solution we believe.
In Mavericks and Yosemite, the preferences for Notification Center are stored in a database in /var/folders. You can find the specific database folder for the logged in user with:
On my computer the database is: /var/folders/8y/0wl97s7x46z279sv8p2h38k80000gn/0/com.apple.notificationcenter/db/db
There is a table called app_info that stores the settings. I wrote a python script that is below that will modify the database. Run with -h to see the help on using it. Run with -i to get specific Bundle IDs.
If you only want to set "Management Actions" to "Alerts" using this script you would upload this script to your JSS and run a policy with the following parameters:
1: -e com.jamfsoftware.Management-Action
2: -a Alert
@jesseshipley Here is the updated version I tested in 10.9 upgraded from 10.8 (appears that it keeps the database in the home directory). Clean install of 10.9 and 10.10 use the /var/folder.
There are two versions now. One for Casper. Read the first couple lines to use with your policy.
@matt4836 Thank you a ton for building these scripts. Exactly what I wanted. I was using this to set the Management Action prompts to Alerts. With your Casper version, there is one line I think that is missing (I added this to line 204) under the “Figure out what app” section….
elif APPS_IN_QUESTION == "CASPER": cur.execute("SELECT * FROM app_info %s"% APPS_WHERE_DICT["CASPER"])
Every other app variable was listed in the list except the Casper one. As soon as I added this line, the modifications to the Management Action notifications took. Again, thanks for the work on that script!
I seem to be missing something, probably obvious to someone, but I'm not seeing it - this script worked perfectly for our local casper admin account, but for any other account on the same machine or any other, it did not take. Our user accounts are Active Directory mobile accounts, but I also tested a locally created account, plus another locally created admin account. None of those took the change. Any ideas of what I've missed folks?
I will GLADLY send Matt some cash if I could get this script to work for us!!!!
@ronb , I too am a big fan of @matt4836 's python script... I've been using it for months, worked like a charm in 10.10. But, please correct me if I'm wrong, I believe it is now breaking because the location of the notification database that the script looks for, in "/var/folders/" has either moved, or it is protected by SIP in 10.11.
I haven't had time to test the script on a SIP disabled 10.11 machine, but my hunch is that this is the case.
I'll +1 tho, for the continued development of the script... OR maybe we just up-vote native notification center messages from Self Service itself, here:
@matt4836 I took a look at your python script as well as some other similar open source projects and found that none of them seem to work any longer (in macOS v10.12.3).
In your research for this script, did you happen to come across a key to decoding the "flags" values found in ~/Library/Preferences/com.apple.ncprefs.plist?
There are some common recurring values such as 14, 22, 86, 535, and 663, with the higher numbers seemingly reserved for Apple applications and system services.
I have had some success with delivering settings via custom payloads in configuration profiles, but I'd like to fully understand the potential values of the flags key.
Hey @milesleacy interested in your experiences with managing notifications with custom config profile. Not having any luck with disabling outlook notifications at lock screen with below as user or device profile... Seems like outlook like changes from 14 to 4110 when checking the option to not allow at lock screen...
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>apps</key> <array> <dict> <key>bundle-id</key> <string>com.microsoft.Outlook</string> <key>flags</key> <integer>4110</integer> </dict> </array> <key>sort_order</key> <integer>0</integer> </dict> </plist>
This seems to work. I'd prefer some sort of documentation as to why and how, but this profile keeps my Jamf notifications set to alert (in an "MCX-often" way - that is, the user can change it, but it gets reset at the next login, even though it's a computer level profile).
This feature request is tangentially related... https://www.jamf.com/jamf-nation/feature-requests/6276/provide-full-notification-center-functonality
Does anyone know how we could simply append the com.apple.ncprefs preference file that is already there with the information described by milesleacy? When I create a config profile and just upload a .plist with the custom settings, as I suspected, it overwrites the file already there on my test machine. This would change users settings for other app notifications which is obviously not desirable. I simply want to append the file with the text below. Any ideas on how to do this successfully with Jamf? Thanks!