Mac OS X,  Mac OS X Server,  Mac Security,  Mass Deployment

Removing Apps from Profile Manager Using Postgres

There aren’t any options in Lion Server’s Profile Manager to remove applications. There are a number of environments where this can be annoying. For example, if you are upgrading or maybe just accidentally upload an app that you don’t want people to see for the rest of the existence of the Profile Manager server. To see which applications have been installed and which have each id:

psql -U krypted -d device_management -c "select * from public.ios_applications limit 1000 offset 0;"

The above command is a standard psql command, as shown in a previous article I worked on in a previous post. But this time I’m injecting the SQL query into the psql command using the -c option. This expands to output a list of each row in the iOS_applications table. Once you see which apps have which unique id’s, you can then remove entries using their  identifiers (this time we’re throwing in a delete instead of select using the -c):

psql -U krypted -d device_management -c "delete from public.ios_applications where id=2;"

Simply re-run without any constraints around your SQL query to clear out all of the application. For example:

psql -U krypted -d device_management -c “delete from public.ios_applications”

This works for most of the tables within Profile Manager. This allows you to clear out any information stored in its own table, such as printers, tasks, sessions, widgets, etc.

Note: you’re not going to remove apps from devices just because you cleared them from the table.