-
Notifications
You must be signed in to change notification settings - Fork 47
/
Casper Site.xml
23 lines (23 loc) · 1.01 KB
/
Casper Site.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?xml version="1.0" encoding="UTF-8"?>
<extensionAttribute>
<displayName>Casper Site</displayName>
<description>This script reports the system's site association as an extended attribute so it can be used as search criteria.</description>
<dataType>string</dataType>
<scriptContentsMac>#!/bin/sh
apiURL="https://yourjss:8443/JSSResource/computers/udid/"
apiUser="APIUser"
apiPass="APIPassword"
MacAdd=$( /usr/sbin/networksetup -getmacaddress en0 | /usr/bin/awk '{ print $3 }' | /usr/bin/sed 's/:/./g' )
udid=$(/usr/sbin/system_profiler SPHardwareDataType | /usr/bin/awk '/Hardware UUID:/ { print $3 }')
siteName=$(/usr/bin/curl -s -u ${apiUser}:${apiPass} "${apiURL}${udid}" | /usr/bin/xpath '/computer/general/site/name[1]/text()' 2>/dev/null)
if [[ $siteName ]]; then
echo "<result>${siteName}</result>"
else
echo "<result>Not Available</result>"
fi</scriptContentsMac>
<scriptContentsWindows/>
</extensionAttribute>