forked from jamf/Jamf-Nation-Extension-Attributes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFile Sharing.xml
39 lines (39 loc) · 1.35 KB
/
File Sharing.xml
1
<?xml version="1.0" encoding="UTF-8"?><extensionAttribute> <displayName>File Sharing</displayName> <displayInCategory>System Information</displayInCategory> <description>This attribute displays whether or not file sharing is enabled. This attribute applies to both Mac and Windows.</description> <dataType>string</dataType> <scriptContentsMac>#!/bin/shOS=`/usr/bin/sw_vers -productVersion | /usr/bin/colrm 5`if [[ "$OS" < "10.5" ]]; then result=`cat /private/etc/hostconfig | grep AFP | sed 's/AFPSERVER=//g'`if [ "$result" == "-Yes-" ]; then echo "<result>On</result>"elif [ "$result" == "-No-" ]; then echo "<result>Off</result>"fielseresult=`/bin/launchctl list | grep "AppleFileServer"`if [ "$result" == "" ]; then echo "<result>Off</result>"else echo "<result>On</result>"fifi </scriptContentsMac> <scriptTypeWindows>VBScript</scriptTypeWindows> <scriptContentsWindows>On Error Resume Next Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")Set colSettings = objWMIService.ExecQuery _("SELECT * FROM Win32_Service WHERE DisplayName='Server'")For Each objService in colSettingsIf objService.State = "Running" Thenstrstatus = "On"Elsestrstatus = "Off"End IfNextWScript.Echo "<result>" & strstatus & "</result>"</scriptContentsWindows></extensionAttribute>