Application List Export minus Apple and Adobe apps

daniel_ross
Contributor III

Ok probably something I'm missing or it is just the way I'm configuring my Smart Group.

We have a need to get a list of any apps not made by Apple or Adobe for review to see what we have in our environment.

I started by making a smart group that looked for com.apple. and com.adobe. using the Application Bundle ID and get nothing useful when I export the data from the results. I'd like to avoid having to make a search line for every Apple or Adobe app. I also know I can filter my results in Excel when I get my output but we'd like to have this somewhat automated so I can kick out a list on a regular interval.

Anyone have some good ideas on how to do this?

2 REPLIES 2

mm2270
Legendary Contributor III

I don't think there would be any good or easy way to do what you're looking for with regular Smart Group criteria. As you already figured out, it doesn't let you use wildcard bundle identifiers, and adding in every possible Apple or Adobe app line by line would be very unwieldy, maybe even impossible.

What you CAN do is build an Extension Attribute script that would gather all apps that are not from Adobe or Apple into one list, per Mac. Then, once you've given it enough time to run on all your Macs, you can pull a report with that EA as a column. The only problem I see is that when exporting EAs that use multiple lines, the export options will not respect the line breaks, since CSVs really can't do that.

However, here is a script line using Apple's Spotlight command line (mdfind) that can pull a list of apps that do not have either com.apple. or com.adobe. as the start of their Bundle Identifiers. This can be wrapped up into an EA script.

mdfind -onlyin /Applications/ '(kMDItemCFBundleIdentifier != "com.apple.*" && kMDItemCFBundleIdentifier != "com.adobe.*") && kMDItemKind == "Application"' | sort -g

In this line, I'm only having mdfind search inside the main Applications folder. If you remove the -onlyin /Applications/ part, it will look throughout the entire HD, which may give you a much larger end result.
If you're concerned about apps that may be installed in the user space, but don't care about ones in the System or Library locations, you can add in another -onlyin line, like this:

mdfind -onlyin /Applications/ -onlyin /Users/ '(kMDItemCFBundleIdentifier != "com.apple.*" && kMDItemCFBundleIdentifier != "com.adobe.*") && kMDItemKind == "Application"' | sort -g

mdfind combines the 2 search locations and will show all apps in the main Applications folder followed by any in any users directories. As long as this gets run by root, as it should in an EA, it will be able to locate apps in other user directories, at least I think so.

Bear in mind both commands may give you a very long result, though, as long as the Spotlight index on the Mac isn't messed up, should actually run pretty fast. On my Mac loaded up with apps, these only take about 0.3 seconds to complete.

Hope the above helps get you on the right track.

daniel_ross
Contributor III

Thanks @mm2270 going to give it a try here as soon as I can and will let you know what I find.