Last active
April 16, 2018 11:46
-
-
Save erikng/add9fabe43a9afc46b959f2844940271 to your computer and use it in GitHub Desktop.
32bitapps.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import subprocess | |
import plistlib | |
cmd = ['/usr/sbin/system_profiler', '-xml', 'SPApplicationsDataType'] | |
proc = subprocess.Popen(cmd, shell=False, bufsize=-1, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
output, err = proc.communicate() | |
plist = plistlib.readPlistFromString(output) | |
items = plist[0]['_items'] | |
for item in sorted(items, key=lambda x: x.get('path')): | |
if 'no' in item.get('has64BitIntelCode'): | |
print [item.get('path'), item.get('_name'), item.get('version')] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I took @igeekjsc's idea and created a Jamf Extension Attribute. Now each computer record will show all installed 32-bit apps.
Side Note: The reason I save to file and then read back in is so that the contents of the
<result></result>
tags is formatted nicely within Jamf.