Skip to main content
Question

Extension Attribute to list File System


Forum|alt.badge.img+7

I tried to create an Extension Attribute to list the Filesystem of each computer in the JSS.

I know the general command is diskutil info / | grep "Type (Bundle)" but don't know how to get the result to list in an inventory search.

Any help is appreciated.

3 replies

Forum|alt.badge.img+8
  • Valued Contributor
  • 96 replies
  • July 2, 2019

!/bin/sh

echo "<result>$(diskutil info / | awk -F': ' '/File System/{print $NF}' | xargs)</result>"


Forum|alt.badge.img+31
  • Honored Contributor
  • 2721 replies
  • July 2, 2019

Using diskutil will give you various results across models and different hardware configurations. The only true way to get it, is to just probe system_profiler, which is a slow as far as binaries go, but it is one of the few ways to always get guaranteed results.

#!/usr/bin/python

import subprocess
import plistlib

cmd = ['system_profiler', 'SPStorageDataType', '-xml']
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = proc.communicate()
data = plistlib.readPlistFromString(out)[0]['_items']
print(data[0]['file_system'])

Forum|alt.badge.img+7
  • Author
  • Contributor
  • 14 replies
  • July 3, 2019

Both scripts did the job. Thanks for your help!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings