Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How do I refresh Profile Manager's printers?

When I first installed Lion Server, I set up some print queues and configured them into Profile Manager's device groups. They pushed out and everything was cool. Except I decided I hate the names I gave the printers. Profile Manager is stuck with the original names.


I've renamed the queues, I deleted and re-created the queues.


When I go into Profile Manager and try to update the profiles. no go. The OLD queue names keep popping up. Ive deleted every payload in Profile Manager that touches the printers. Every time I try to add a new printer profile, the old queue names pop-up.


I've restarted profile manager several times to no avail.


I'm guessing somwhere there's a plist to delete or something to tell Profile Manager to re-read the configured printers.


Any thoughts???


Thanks

Posted on Aug 4, 2011 8:25 PM

Reply
31 replies

Apr 10, 2012 7:38 PM in response to joe_mck

Hi, joe_mck. I would gather that if you were to change the name of a printer or delete a printer in System Preference the change would not take in Profile Manager. The issue is to be a problem with a helper file backbend of Profile Manager or device manager. First create the test. Change the name of a printer and/or delete a printer in System Preferences. Restart Profile Manger in Server.app and then log into Profile Manager web interface and try to add a printer to a user/device profile and see if the change took place in the list of printers. If the name change or printer that was delete in System Preferences did not delete in Profile Manger web interface go to this file location:


/usr/share/devicemgr/backend/helpers/printer_helper.rb


Once you have opened this ruby file in your favorite text editor make these changes to the file. Once you have made the change restart Profile Manager from Server.app and try the test again as listed above and see if it works.


Sincerly,


Timothy



# update current printers to the cached printers in the db
   current_printer_identifiers.each{|identifier|
     p_hash = current_printers.select{|x| x['identifier'] == identifier}.first
    
    if (p_hash)
       p = Printer.find_by_identifier(identifier);
       if p
       p.deleted = false
       p_hash.each { |key, value| p[key] = value if p.respond_to?(key) }
       p.save
        end
     end
   }


    # Remove non-existant printersfrom database
     removed_printer_identifiers.each{|identifier|
       p = Printer.find_by_identifier(identifier);
       if p
         p.deleted = true
         p.save
       end
     }

Jul 30, 2012 7:44 AM in response to joe_mck

You can also go and manually remove printer entries from the Postgres database that holds all profile information.


You can find information at this link: http://krypted.com/iphone/working-with-postgres-from-the-command-line-in-lion-se rver/


It helped me quite a bit. Once you get in as a user


select * from printers;


Find the printer you want to remove:


delete from printers where id=[the id of the printer you want to remove];


You need to close and reopen profile manager -- or maybe even restart the server -- for the change to show in the management screen. You could also try marking the printer as deleted with:


update printers set deleted=TRUE where id=[id...];


That did not work for me on the first try, but I did not reboot the server afterward, so maybe it was just that I did not see the impact.


I agree though, this is a pain. Apple's printer functionality in Profile Manager seems to be terribly underdeveloped. I might go as far as to say it is not ready for prime time.

Jun 12, 2013 5:13 PM in response to joe_mck

Has anyone gotten this to work in 10.8 server? I've tried bornpilot's fix using Yaron360's location, and I can see and edit the file, but after restarting the profile manager service, all the printers basically just become locked in the "remove" position in profiles. Printers that are removed from system prefs or name changed dont actually change.


I'd be happy to go in and edit the database file by hand, but everytime I try to use a psql command i get the following error:


psql: could not connect to server: No such file or directory

Is the server running locally and accepting

connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?


Anyone have any suggestions?

Thanks!

Jun 13, 2013 11:48 AM in response to fkick1

To avoid the error you need to change the permissions on the socket file. so in Terminal do:

sudo chmod o+rw /var/pgsql_socket/.s.PGSQL.5432


but in 10.8 the server locaton has chnage so you need to go to:

/Library/Server/PostgreSQL For Server Services/Socket


So your command will look like this:

sudo chmod o+rw /Library/Server/PostgreSQL\ For Server\ Services/Socket.s.PGSQL.5432


Now you can get in with user _postgres and password will be your admin password


Once you are done you should change the permissions back by running the same command and replacing o+rw with o-rw

Sep 10, 2013 9:00 AM in response to fkick1

I don't know the first thing about pgsql but I'm figuering it out. What I do know is to get in use this command.


sudo /Applications/Server.app/Contents/ServerRoot/usr/bin/psql -U _postgres -d device_management -h /Library/Server/PostgreSQL\ For\ Server\ Services/Socket/


Note you have to use the correct scoket to see whats in it. I didn't have to change any permissions on anything to get in this way. At least I don't rember doing it.

Sep 10, 2013 11:11 AM in response to sofalounge

OK I think I've figured it out. Please correct if you see errors.


First you have to get into the database. I didn't need to set any special permissions or add users to the DB to do this. You do want to have have the initial command run as root. I actually ran sudo -s to become root first. Then ran these commands.


Before any of this I cleared the printers from System Preferences and actually did a full reset on the printing system, right click in Print & Scan.


This will connect you to the correct database using the correct version of psql.


/Applications/Server.app/Contents/ServerRoot/usr/bin/psql -U _postgres -d device_management -h /Library/Server/PostgreSQL\ For\ Server\ Services/Socket/


Note that if you are running Server 10.8.2 then psql is 9.2.1, the psql in /usr/bin/psql is older and not the one you want.


At the prompt list your db with \d, note that device_management=# is your prompt while you are in the db. Type help, \h or \? to get more info.


device_management=# \d


Now you will see the tables. The ones you are after are public | printers and public | printing_knob_sets. You can see the contents of the tables this way.


device_management=# select * from "public"."printers" ;


device_management=# select * from "public"."printing_knob_sets" ;


To clear these tables run the following.


device_management=#  DELETE FROM printers ;


device_management=#  DELETE FROM printing_knob_sets ;


After all that I was able to recreate the printers and add them to Profile Manager. With more knowledge about pgsql you should be able to remove individual printers from the table or add them in.

Dec 10, 2013 6:18 PM in response to bornpilot

On 10.9 this causes an error and failure when attempting to display the available printers in Profile Manager.


If I leave as is then what seems to happen is that when I delete printers in Sys Prefs, Profile Manager doesn’t update its printer list. Same if I rename existing printers.


If I add new printers, they sometimes show up in PM and sometimes don’t.

Dec 11, 2013 6:07 AM in response to Ofir Gal

I poseed thing info in another thread also but too much info isn't a bad thing.


For Mavericks (10.9) and Server 3 Apple changed the postreas setup again, just slightly.


Apple removed /user/bin/psql and associated apps so now you only have one psql to deal with and it’s in your environment path. Running ‘which psql’ will show you /Applications/Server.app/Contents/ServerRoot/usr/bin/psql


That has simplified things a little.


The socket has moved also and is now in:

/Library/Server/ProfileManager/Config/var/PostgreSQL/


So to get into the database run this command.

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


Use \d to see the tables \h to get help \q to exit. See the man page or the postgresql documentation online for more if you are new to this, like me.

Dec 11, 2013 5:44 PM in response to marc7654

Thanks, I'm one step closer. When I try this is what I get:


device_management=# select * from "public"."printers" ;

id | last_modified_guid | admin_session | temporary_id | deleted | created_at | updated_at | identifier | DeviceURI | DisplayName | Location | Model | PPDURL | PrinterLocked

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

(0 rows)



But when I use Profile Manager I see 8 printers listed.

Dec 12, 2013 7:56 AM in response to Ofir Gal

I'm seeing a simular issue in my test setup. Not sure if you can do a printing system reset on the server and have it clear out. Also it's not applying the printers to my test client. I've seen this before but a machine that's been on your profile server then removed and recreated for the profile server appears to have issues. That may be what's going on for me. There has to be some machine ID info someplace that's not really being cleared out when you remove a machine from Profile Manager.

How do I refresh Profile Manager's printers?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.