-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathBrowser_Application_Default.xml
33 lines (33 loc) · 1.81 KB
/
Browser_Application_Default.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?xml version="1.0" encoding="UTF-8"?>
<extensionAttribute>
<displayName>Browser Application Default</displayName>
<description>This will determine the last user logged in and determine the default handler of content 'http'. </description>
<dataType>string</dataType>
<scriptContentsMac>#!/bin/sh
#####################################################################
# Find the Default Browser on Mac OS X for the last logged in user
# Cobbled together from other's hard work
# By: Christopher T. Miller, Dated: 2014-11-13, Last Mod: 20141119
# For ITSD-ISS of JHU-APL
#####################################################################
# use the 'last' command to find the last real user.
# It will skip over the following users: reboot, shutdown, root, wtmp, adobeinstall, and any user you specify.
LastUser=`/usr/bin/last console | /usr/bin/awk '{print $1}' | /usr/bin/sed -e '/^$/d' -e '/^root$/d' -e '/^wtmp$/d' -e '/^adobeinstall$/d' | /usr/bin/awk 'NR>1{exit};1'`
# Scour the Last User's LaunchServices plist file for the handler of content type "http"
DefaultBrowser=$(/usr/bin/defaults read /Users/$LastUser/Library/Preferences/com.apple.LaunchServices.plist | grep http -B 2 | awk '{print $3}' | tail -n 2 | head -n 1 | sed -e 's/[";,)]//g')
# Check the value of variable "DefaultBrowser" for absence of data and insert a negative finding if blank (IE no Default Browser App Setting)
# This helps define which Macs have or haven't yet inventoried with the extension attribute
if [ "$DefaultBrowser" == "" ]
then
DefaultBrowser="No Default Browser Defined"
fi
# Output the results
echo "<result>$DefaultBrowser</result>"
exit 0</scriptContentsMac>
<scriptContentsWindows/>
</extensionAttribute>