Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
pbowden-msft authored Mar 1, 2018
1 parent aa9b5e4 commit 60800fb
Showing 1 changed file with 110 additions and 0 deletions.
110 changes: 110 additions & 0 deletions Office_License.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?><extensionAttribute>
<displayName>Office_License</displayName>
<description/>
<dataType>string</dataType>
<scriptContentsMac>#!/bin/sh&#13;
&#13;
&lt;&lt;ABOUT_THIS_SCRIPT&#13;
-----------------------------------------------------------------------&#13;
&#13;
Written by:William Smith&#13;
Professional Services Engineer&#13;
Jamf&#13;
bill@talkingmoose.net&#13;
https://github.com/talkingmoose/Casper-Scripts&#13;
&#13;
Adapted from a script by: Paul Bowden&#13;
Software Engineer&#13;
Microsoft Corporation&#13;
pbowden@microsoft.com&#13;
https://github.com/pbowden-msft/Unlicense&#13;
&#13;
Originally posted: January 7, 2017&#13;
Last updated: January 7, 2017&#13;
&#13;
Purpose: Use this script as part of an extension attribute in Jamf&#13;
to report the type of Microsoft Office 2016 licensing in use.&#13;
&#13;
Except where otherwise noted, this work is licensed under&#13;
http://creativecommons.org/licenses/by/4.0/&#13;
&#13;
"Communication happens when I know that you know what I know."&#13;
&#13;
INSTRUCTIONS&#13;
&#13;
1) Log in to the Jamf Pro server.&#13;
2) Navigate to JSS Settings &gt; Computer Management &gt; Extension Attributes.&#13;
3) Click the " + " button to create a new extension attribute with these settings:&#13;
Display Name: Office 2016 License&#13;
Description: Reports Office 2016 licenses in use.&#13;
Data Type: String&#13;
Inventory Display: Extension Attributes&#13;
Input Type: Script&#13;
Script: &lt; Copy and paste this entire script &gt;&#13;
4) Save the extension attribute.&#13;
5) Use Recon.app or "sudo jamf recon" to inventory a Mac with Office 2016.&#13;
6) View the results under the Extension Attributes payload&#13;
of the computer's record or include the extension attribute&#13;
when adding criteria to an Advanced Computer Search or Smart Group.&#13;
&#13;
-----------------------------------------------------------------------&#13;
ABOUT_THIS_SCRIPT&#13;
&#13;
&#13;
# Functions&#13;
function DetectVolumeLicense {&#13;
VOLUMELICENSE="/Library/Preferences/com.microsoft.office.licensingV2.plist"&#13;
&#13;
# checks to see if a volume license file is present&#13;
if [ -f "$VOLUMELICENSE" ]; then&#13;
/bin/echo "Yes"&#13;
else&#13;
/bin/echo "No"&#13;
fi&#13;
}&#13;
&#13;
function DetectO365License {&#13;
# creates a list of local usernames with UIDs above 500 (not hidden)&#13;
userList=$( /usr/bin/dscl /Local/Default -list /Users uid | /usr/bin/awk '$2 &gt;= 501 { print $1 }' )&#13;
&#13;
while IFS= read aUser&#13;
do&#13;
# get the user's home folder path&#13;
homePath=$( eval /bin/echo ~$aUser )&#13;
&#13;
# list of potential Office 365 activation files&#13;
O365SUBMAIN="$homePath/Library/Group Containers/UBF8T346G9.Office/com.microsoft.Office365.plist"&#13;
O365SUBBAK1="$homePath/Library/Group Containers/UBF8T346G9.Office/com.microsoft.e0E2OUQxNUY1LTAxOUQtNDQwNS04QkJELTAxQTI5M0JBOTk4O.plist"&#13;
O365SUBBAK2="$homePath/Library/Group Containers/UBF8T346G9.Office/e0E2OUQxNUY1LTAxOUQtNDQwNS04QkJELTAxQTI5M0JBOTk4O" # hidden file&#13;
&#13;
# checks to see if an O365 subscription license file is present for each user&#13;
if [[ -f "$O365SUBMAIN" || -f "$O365SUBBAK1" || -f "$O365SUBBAK2" ]]; then&#13;
activations=$((activations+1))&#13;
fi&#13;
done &lt;&lt;&lt; "$userList"&#13;
&#13;
# returns the number of activations to O365ACTIVATIONS&#13;
/bin/echo $activations&#13;
}&#13;
&#13;
## Main&#13;
&#13;
VLPRESENT=$(DetectVolumeLicense)&#13;
O365ACTIVATIONS=$(DetectO365License)&#13;
&#13;
if [ "$VLPRESENT" == "Yes" ] &amp;&amp; [ "$O365ACTIVATIONS" ]; then&#13;
/bin/echo "&lt;result&gt;Volume and Office 365 licenses detected. Only the volume license will be used.&lt;/result&gt;"&#13;
&#13;
elif [ "$VLPRESENT" == "Yes" ]; then&#13;
/bin/echo "&lt;result&gt;Volume license&lt;/result&gt;"&#13;
&#13;
elif [ "$O365ACTIVATIONS" ]; then&#13;
/bin/echo "&lt;result&gt;Office 365 activations: $O365ACTIVATIONS&lt;/result&gt;"&#13;
&#13;
elif [ "$VLPRESENT" == "No" ] &amp;&amp; [ ! "$O365ACTIVATIONS" ]; then&#13;
/bin/echo "&lt;result&gt;No licenses&lt;/result&gt;"&#13;
fi&#13;
&#13;
exit 0</scriptContentsMac>
<scriptContentsWindows/>
</extensionAttribute>

0 comments on commit 60800fb

Please sign in to comment.