8 Replies Latest reply on Apr 5, 2018 1:21 PM by [email protected]

    Delete Network Printer via LANrev


      I have pushed a printer to several Macs via Configuration Profile and now the printer has changed.  I have created a new profile for the new printer, but how do I use LANrev to remove the old printer without going to each Mac (Most of these are laptops that I'll never see) and without messing up any local printers they may have installed?


      Thank you in advance.

      LANrev 7.4.1

        • 1. Re: Delete Network Printer via LANrev
          sgillaspy Apprentice

          You should be able to choose the install instance of the printer profile in the Computers window.  Choose the computer, move to the computer's "Installed Profiles".   Right-click to choose "Remove Profile from Computer".


          It should leave local printers alone.


          It may take a login/logout for changes to be reflected in the console however.  The 'Number of Printers Installed" column won't be correct until both a user has logged in and you have re-gathered info on that computer.

          • 2. Re: Delete Network Printer via LANrev

            As far as I have observed, as soon as you remove the printer profile, it does not uninstall the printer config. The next time you install again the same printer profile you will end up with 2 printer configs. It would be great if there was an option to delete the printer once the profile is removed.


            I guess you will have to script the removing of printers using 'lpadmin' command, you can run the script every log out of the user to ensure you get an updated printer config. However, I am not sure how you exclude the local printers for the laptops.

            • 3. Re: Delete Network Printer via LANrev
              sgillaspy Apprentice

              Yes, I have seen that behavior as well.  For the instances where I want a clean printing start for the target mac (no preservation of network or local printers or queues) I run this command from LANrev before pushing out the new printing profile:


              lpstat -p | cut -d' ' -f2 | xargs -I{} lpadmin -x {}



              For preserving local printers there is this variant (courtesy the JAMF gurus-I haven't tested it so test, test):


              lpstat -p | cut -d' ' -f2 | grep mcx | xargs -I{} lpadmin -x {}



              I use the first script when my targets are logged out, and have only tested it and not the second one. 


              Have used the no preservation script many times and know it works well.

              • 4. Re: Delete Network Printer via LANrev

                I get an error no matter what I type and I assume my error is resulting from the "computer profile" rather than "user profile"  or the fact that the profile was delivered via management (I don't know if this profile is 'removable' at the client.)

                • 5. Re: Delete Network Printer via LANrev
                  sgillaspy Apprentice

                  You have control over whether the profile is removable.  That control popup is in the Profile's General payload under "Security".


                  We only use Computer profiles here, and no User profiles.  All our printing is IPP/LPR and Pharos.  We don't use SMB printing, so I can't speak to how well those work  via profile.


                  Use the commands above for a fresh start on the target mac, then deploy your profile to manage to the printer settings.  A user will need to log in and back out before you will see correct information about the printer in LANrev.

                  • 6. Re: Delete Network Printer via LANrev

                    In the Profile's General payload under "Security" I have "Controls when the profile can be removed" = "Always"


                    We use only IP printers,


                    "lpstat -p | cut -d' ' -f2 | grep mcx | xargs -I{} lpadmin -x {}" removed the printer, but the profile did not remove even though I removed the computer from the group so the printer reinstalled at next login.


                    I found that the following command will remove the profile, but only when executed locally.  I cannot get it to run via LANrev via "Execute Script"

                    "sudo profiles -R -p <ProfileName>"


                    Login/logoff though will not reinstall other network printers via other profiles.  A restart brought the other network printers back.


                    My only other thought was to modify the profile to use the "Automatically Remove Profile" in the "Configuration Profile Editor."  If that is my best option, I just need to test the modification and whether changing that after the policy applied would actually remove the policy.

                    • 7. Re: Delete Network Printer via LANrev
                      sgillaspy Apprentice

                      Deleting printers with the commands above and removing profiles are separate steps.


                      If all is functioning properly, you should have control of removing the profile centrally in the LANrev Admin console.  Finding where to do this can be tricky though.  You must expand the computer in the Computers window sidebar, then navigate to "Installed Profiles" --choose the printing profile you are trying to remove --right click and choose "Remove Profile from Computer".  Also, check to make sure that a Profile Distribution Group (in the Server Center) isn't pushing the profile back to the target computer, because this can happen very rapidly in systems that are functioning well, and it can give the appearance that the profile failed to remove.


                      I usually remove the profile first and reset printing with the commands above second.

                      • 8. Re: Delete Network Printer via LANrev

                        Thank you!  Removing the profile did the trick for me.  I could easily remove the computer from the group where the profile was located, but could not remove the profile.  Removing the printer was easy at that point.