Batch deleting printers

KB Home   |   Batch deleting printers

Main.BatchDeletingPrinters History

Hide minor edits - Show changes to output

April 02, 2018, at 06:20 PM by 207.173.252.92 -
Changed line 11 from:
--->i) Open a command prompt.
to:
--->i) Open a command prompt,(run as administrator).
Changed lines 15-16 from:
--->iv) [@server-command delete-printer "server\printer"@]
to:
--->iv) [@server-command delete-printer "server" "printer"@]
Added lines 23-25:
----
''Categories:'' [[Category.Printers|+]]
----
July 26, 2010, at 03:03 AM by matt - User the server-command not SQL
Changed lines 9-20 from:
-->'''3.''' You can use the following SQL command to delete all printers:

--->i) Manually stop the "PaperCut Application Server Service" under Control Panel -> Admin Tools -> Services

--->ii) Open a command prompt

--->iii) cd C:\Program Files\PaperCut NG\server\bin\win

--->iv) [@db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y' WHERE display_name = 'server\printer'"@]

--->v) Repeat line above for each printer

to:
-->'''3.''' You can use the @@delete-printer@@ server command to script the deletion of the printers.

--->i) Open a command prompt.

--->ii) cd C:\Program Files\PaperCut NG\server\bin\win 
  (or appropriate directory for your platform)

--->iv) [@server-command delete-printer "server\printer"@]

--->v) Repeat line above for each printer to delete.
Changed lines 21-28 from:
-->'''4.''' Or a partial list of printers matching a substring  (Advanced SQL) using same procedure as 3:

--->[@db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y' WHERE display_name LIKE '%server_name%' "@
]

-->'''5
.''' Or all printers:

--->@@db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y'" @@

to:
For more information on @@server-command@@ see the [[https://www.papercut.com/products/ng/manual/apdx-tools.html#apdx-tools-server-command | the manual]].
Changed lines 7-8 from:
-->'''2.''' If your setup is now and just in testing at the moment, one simple option could be simply uninstall and re-install resetting the data.
to:
-->'''2.''' If your setup is in testing at the moment, one simple option could be simply uninstall and re-install resetting the data.
Changed lines 3-4 from:
'''I'd like to remove around 2400 printers from the database (that were added before I discovered the "ignore printers" option, and was wondering if there is a way I can write or get a script to delete them?'''
to:
'''I'd like to remove around 2,400 printers from the database (that were added before I discovered the "ignore printers" option, and was wondering if there is a way I can write or get a script to delete them?'''
Changed lines 21-22 from:
''Note:''  One trick is to maybe use an exported list of printers in EXCEL and a simple string join formula to generate the list of commands, then save the text as a batch file.
to:
-->''Note:''  One trick is to maybe use an exported list of printers in EXCEL and a simple string join formula to generate the list of commands, then save the text as a batch file.
Changed lines 24-25 from:
--->@@db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y' WHERE display_name LIKE '%server_name%' "@@
to:

--->[@db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y' WHERE display_name LIKE '%server_name%' "@]
Changed lines 28-31 from:
--->@@db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y'" @@
to:

--->@@db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y'" @@

[-keywords: delete, bulk delete, remove multiple printers -]
Changed lines 17-18 from:
--->iv) db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y' WHERE display_name = 'server\printer'"
to:
--->iv) [@db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y' WHERE display_name = 'server\printer'"@]
Changed lines 21-22 from:
     Note:  One trick is to maybe use an exported list of printers in EXCEL and a simple string join formula to generate the list of commands, then save the text as a batch file.
to:
''Note:''  One trick is to maybe use an exported list of printers in EXCEL and a simple string join formula to generate the list of commands, then save the text as a batch file.
Changed lines 24-25 from:
           db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y' WHERE display_name LIKE '%server_name%' "
to:
--->@@db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y' WHERE display_name LIKE '%server_name%' "@@
Changed line 27 from:
          db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y'"
to:
--->@@db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y'" @@
Added line 12:
Added line 14:
Added line 16:
Added line 18:
Changed line 27 from:
           db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y'"
to:
           db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y'" 
Changed lines 11-16 from:
            i) Manually stop the "PaperCut Application Server Service" under Control Panel -> Admin Tools -> Services
 
         ii) Open a command prompt
            iii) cd C:\Program Files\PaperCut NG\server\bin\win
            iv) db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y' WHERE display_name = 'server\printer'"
           
v) Repeat line above for each printer
to:
--->i) Manually stop the "PaperCut Application Server Service" under Control Panel -> Admin Tools -> Services
--->ii) Open a command prompt
--->iii) cd C:\Program Files\PaperCut NG\server\bin\win
--->iv) db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y' WHERE display_name = 'server\printer'"
--->v)
Repeat line above for each printer
Changed line 23 from:
           db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y'"
to:
           db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y'" 
Added lines 1-23:
(:title Batch deleting printers :)

'''I'd like to remove around 2400 printers from the database (that were added before I discovered the "ignore printers" option, and was wondering if there is a way I can write or get a script to delete them?'''

-->'''1.''' The first option is of course, manual hard labor!

-->'''2.''' If your setup is now and just in testing at the moment, one simple option could be simply uninstall and re-install resetting the data.

-->'''3.''' You can use the following SQL command to delete all printers:

            i) Manually stop the "PaperCut Application Server Service" under Control Panel -> Admin Tools -> Services
            ii) Open a command prompt
            iii) cd C:\Program Files\PaperCut NG\server\bin\win
            iv) db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y' WHERE display_name = 'server\printer'"
            v) Repeat line above for each printer

      Note:  One trick is to maybe use an exported list of printers in EXCEL and a simple string join formula to generate the list of commands, then save the text as a batch file.

-->'''4.''' Or a partial list of printers matching a substring  (Advanced SQL) using same procedure as 3:
            db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y' WHERE display_name LIKE '%server_name%' "

-->'''5.''' Or all printers:
            db-tools run-sql "UPDATE tbl_printer SET deleted = 'Y'"

Comments

Share your findings and experience with other PaperCut users. Feel free to add comments and suggestions about this Knowledge Base article. Please don't use this for support requests.

Article last modified on April 02, 2018, at 06:20 PM
Printable View   |   Article History   |   Edit Article