MYAMRG

Q: Need to Pull Inventory from Profile Manager

We have 125+ ipad devices in Profile manager.  I'd like to export the ipad name, serial# and cellular carrier and other cellular info for all devices into a CSV or text file.  I can go to the details section of each device and manually look each one up but this is to tedious. 

 

There has got to be a way to use Profile Manager to help inventory devices, if not this needs to be a critical added feature.

OS X El Capitan (10.11.4)

Posted on May 19, 2016 7:58 AM

Close

Q: Need to Pull Inventory from Profile Manager

  • All replies
  • Helpful answers

  • by Strontium90,Solvedanswer

    Strontium90 Strontium90 May 20, 2016 4:59 AM in response to MYAMRG
    Level 5 (4,077 points)
    Servers Enterprise
    May 20, 2016 4:59 AM in response to MYAMRG

    This can be done.  You need to query the database directly.  Try this:

     

    1:  Connect to the database (do this on the server running Profile Manager)

     

         sudo psql -U _devicemgr -d devicemgr_v2m0 -h /Library/Server/ProfileManager/Config/var/PostgreSQL

     

    2:  You will be prompted for your admin password.  You will not see it as you type.  Hit Return when complete.

     

    3:  You will be in the interactive shell and get a prompt like the following:

         psql (9.3.9)

         Type "help" for help.

     

    4:  Congratulations, you have connected to the database.  Let’s start digging and find out what is stored in there.


    5:  To list the databases, use this command (that is a lower case L):

         \l

     

    6:  You should see a result that looks similar to the following:

                                      List of databases

          Name      |   Owner    | Encoding | Collate | Ctype |     Access privileges    

    ----------------+------------+----------+---------+-------+--------------------- ------

    devicemgr_v2m0 | _devicemgr | UTF8     | C       | C     |

    postgres       | _devicemgr | UTF8     | C       | C     |

    template0      | _devicemgr | UTF8     | C       | C     | =c/_devicemgr            +

                    |            |          |         |       | _devicemgr=CTc/_devicemgr

    template1      | _devicemgr | UTF8     | C       | C     | _devicemgr=CTc/_devicemgr+

                    |            |          |         |       | =c/_devicemgr

    (4 rows)

     

    7:  The database of interest is titled devicemgr_v2m0.  In order to interact with it we must select it.  To select a database, use this command:

          \c devicemgr_v2m0;

     

    8:  Provided you switched successfully, you should see this notification.

         You are now connected to database "devicemgr_v2m0" as user "_devicemgr".

     

    9:  To view all the tables in the database, using this command:

         \dt

     

    10:  From the list you will see some tables of interest.  For example, devices, device_groups, vpp_products, xsan_networks, etc.  To view what is stored inside these tables, use the following command:

         select * from devices;

     

    11:  Change devices to another table name if you want to explore other tables.

     

    12:  Now get what you want.  Here are two example queries:

         select "DeviceName","SerialNumber" from devices;

         select "DeviceName",last_checkin_time from devices;


    13:  String together the columns you want to collect to get your report. 


    14:  Dump results to a text file.


    15:  When finished, quit the interactive shell with

         \q


    Hope this helps.  Can be done.  Enjoy running your reports.


    Reid

    Apple Consultants Network

    Author - "El Capitan Server – Foundation Services"

    Author - "El Capitan Server – Control & Collaboration"

    Author - "El Capitan Server – Advanced Services"

    :: Exclusively available in Apple's iBooks Store