Have you ever tried to locate MAC App data in the database? Have you tried to write a report to show just MAC Apps?
Here is a very simple 10 minute way to setup a Custom MAC App Inventory.
1. Create a new Task (Run Script)
2. Name the Task
3. Select Python Script from the drop down
4. Copy the below text below into the text area
# coding: utf-8
#!/usr/bin/python
import os
import subprocess
import plistlib
import sys
import datetime
def appScan():
os.system("system_profiler -xml SPApplicationsDataType > apps.xml")
appList = plistlib.readPlist("apps.xml")
outputStr = 'Mac_App_List\nDelimiters=\"^\"\nstring50 string80 string50\n"Name"^"LastModified"^"Version"\n'
appDict = appList[0]['_items']
for x in appDict:
if 'version' in x:
outputStr = outputStr + str(x['_name']) + "^" + str(x['lastModified']) + "^" + str(x['version']) + "^" + "\n"
else:
outputStr = outputStr + str(x['_name']) + "^" + str(x['lastModified']) + "^""no version found" + "^" + "\n"
return outputStr
proc = subprocess.Popen(["/opt/altiris/notification/inventory/lib/helpers/aex-sendcustominv","-t"], bufsize=-1, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
proc.communicate(appScan())
5. Save Changes
6. Create a custom data class (this one is named Mac_App_List) (see script line number 12 this is where you must match the table name, attributes, data type, size)
7. Add attributes:
Name, string, 50, No, No
LastModified, string, 80, No, No
Version, string, 50, No, No
8. Check the Allow multiple rows from a single computer resource box.
9. Save Changes
You can now run the task you created against a MAC machine and the data will populate in the database table. You can now create a policy and generate a few reports.