gunverth

Q: How to export device data from Profile Manager

I've been searching for a good psql-recipe to export the device data in Profile Manager, when my coding colleague more or less solved it in a minut with a one-liner. I justed forgot to ask him. Here you go:

 

 

psql -h /Library/Server/ProfileManager/Config/var/PostgreSQL -U _devicemgr -d devicemgr_v2m0 -c "select \"DeviceName\",\"SerialNumber\",\"WiFiMAC\" from devices where mdm_target_type = 'ios';"

 

or maybe

psql -h /Library/Server/ProfileManager/Config/var/PostgreSQL -U _devicemgr -d devicemgr_v2m0 -c "select \"DeviceName\",\"SerialNumber\",\"WiFiMAC\" from devices where mdm_target_type = 'ios';" > ~/Desktop/devices.txt

 

to get a file.

 

 

This command can be run on the live database, so no need to make an backup before you start digging into it.

Posted on Oct 15, 2015 4:59 AM