Mac Management Group

 View Only

Custom Mac Software Inventory Tool 

Jul 30, 2012 11:16 AM

The Mac OS X software inventory reporting is currently lacking compared to the Windows software reporting. For Windows there is the AddRemoveProgram table that provides a lot of useful software data. This tool in conjunction with a Custom Data Class table will give you a lot more details about installed Mac software. The attached tool does all the work, all you need to do is create the new data class.

Create a Custom Data Class named anything you want. Remember what you name it, you'll need to specify the name when you use the tool.

Add the following attributes to the class:

Attribute Name Data Type Size
Name String 255
Path String 1024
Info String 255
Version String 255
Runtime String 80
LastModified String 80
Has64BitCode Booleen 1
AppStore Booleen 1

None of the attributes are required, but you could make Name and Path required if you want. Both of those should always contain a value. Make sure to check the box that says "Allow multiple rows from a single computer resource."

 

Run the attached tool from a your Mac that is already running the Altiris agent. Make sure if you are testing it locally, to proceed the command with sudo to elevate the privileges. If you are running it as part of an Altiris policy, it will already be running with the root privileges.

You must pass the name of the table to the tool like this:

SoftwareInventoryReporter --table MyTable

 

SoftwareInventoryReporter: Usage:
  -t | --table               Specify the Custom Inventory
         <table name>          Table Name. (Required argument.)

  -s | --save                Save the output submit script
         <path to file>        file. (Optional argument.)

  -r | --rootonly            Report only apps on the / drive only.
                               (Optional argument.)

  -n | --nosubmit            Do not submit the report to the NS.
                               (Optional argument.)

  -v | --version             Display version and exit
  -a | --about               Display about and exit
  -h | --help                Display this help and exit
Use this for full details:

SoftwareInventoryReporter --help

Essentially this tool will query the system_profiler tool and retrieve a full report for all installed applications. Then it reformats the output into a format that the Altiris Mac custom inventory tool understands. Then it submits the inventory to the NS.

I added options for saving the generated script and skipping the submit process, if you want to have a look at the output before you actually do a submit.  You could use the tool to only generate the script and then have some other process on the machine do the submit at a later time.

SoftwareInventoryReporter --table MyTable --nosubmit --save "/path/to/save/file.sh"

Once you are satisfied with the results, push the tool out to all your Macs and then setup a policy to run it regularly.

Much more complete Mac application data will now be available in Altiris for reports, filters, etc, similar to the Inv_AddRemoveProgram table for Windows software that already exists.

This tool should work on 10.6 and later. Untested on 10.5 and earlier, but may work? Let me know if it does and I will update this article.

Updated v1.01 tool and sample report attached.

Statistics
0 Favorited
2 Views
3 Files
0 Shares
0 Downloads
Attachment(s)
zip file
report.sh_.zip   15 KB   1 version
Uploaded - Feb 25, 2020
zip file
SoftwareInventoryReporter v1.01.zip   32 KB   1 version
Uploaded - Feb 25, 2020
zip file
SoftwareInventoryReporter.zip   28 KB   1 version
Uploaded - Feb 25, 2020

Tags and Keywords

Comments

Feb 13, 2013 01:33 AM

YES, it worked!

When i was creating the Custom Data Classes i followed this guide: http://www.symantec.com/business/support/index?page=content&id=HOWTO63944

 

Many thanks for your help!

Regards Johan

Feb 12, 2013 05:20 PM

I think you are creating your custom data class in the wrong location. You want to create the data class under the Inventory Solution here:

 

 

Feb 12, 2013 01:59 AM

The screenshot is from the file that creates when i do the command sudo ./SoftwareInventoryReporter --table MacCustomDataClass

When i do the command with --nosubmit --save "./sir.out" i have those top two lines you say.

 

I've noticed that DataClasses view does not look exactly the same, we are running Altiris 7.1 can this be a problem?

 

Feb 08, 2013 02:56 PM

I just checked out your screen shots after posting my last comment. The data is correctl delimited in the save file. However, you may have just not captured the top two lines of the output in your screen shot but there should be two additional lines at the beginning of the file:  ". `aex-helper...` and a "# Script_begins_here". 

At this point, the only other possibility is the data class definition. Can you get a screen shot and post it, if needed? 

Feb 08, 2013 02:25 PM

Try running the command without submitting to the NS and redirecting the output to a local file. Here's sample syntax: 

      sudo ./SoftwareInventoryReporter --table MyTable --nosubmit --save "./sir.out"

When it finishes, look thru the file. Starting at about line 9, you'll notice a bunch of 'echo' statements with the actual data. Each column is delimited by "^". You can count the fields and compare them to the sample data class columns in this article, above, to determine if things are in the right column. I just did and it appears to be correct. If that is correct for you, then I would check your data class and ensure that the schema truly matches the recommended schema in this article. 

 

Feb 08, 2013 10:54 AM

Seems strange, the only thing I can think of is the custom data class definition. Here's a screenshot of mine:

Feb 08, 2013 01:32 AM

Everything looks fine in custominv.sh but look at the screeenshort from the SQL query, the Name column has the Path values. The Path column has the Info value etc.

 

Watch the two attached files.

 

Regards Johan

Feb 07, 2013 11:57 AM

 

If you want to produce a sample file to review the output, you could do so like this:
 
sudo ./SoftwareInventoryReporter --save /path/to/report.sh --table MyMacApplicationsTable --nosubmit
 
(Where table = your table name, and save = the file you want to save output)
 
This will generate a script. Which is what it does normally, but then normally it will execute the script to send the custom inventory. With the --nosubmit, it will not submit the data.
 
Once you have the script, open it with TextWrangler, or other text editor to see the results. You can comment out the first line (. `aex-helper info path -s INVENTORY`/lib/helpers/custominv_inc.sh) and run it in the terminal and all output will simply echo to the terminal. It should do this without an error.
 

Feb 07, 2013 04:51 AM

Hi,

I dont get any info in the NAME column.
Instead everything is moved one column to the left.

 

In the Name column path shows.

In the Path column info shows etc.
 

We are running Mountain Lion 10.8.2

Related Entries and Links

No Related Resource entered.