Dashboard > Documentation > ... > Image Builder and Cloner Clinic > Adding and Removing CUPS Printers to Windows via Command Line
Documentation Log In   View a printable version of the current page.
Adding and Removing CUPS Printers to Windows via Command Line

Added by Paul Smernoff , last edited by Paul Smernoff on Oct 24, 2007  (view change)
Labels: 
(None)

Adding and Removing CUPS Printers to Windows via Command Line

The following process demonstrates how to add a printer to a Windows workstation via Command Line. This is necessary for those adding printers to Windows workstations that have non-admin user accounts as printers added via the GUI by the administrator are not visible to non-admin users. This makes the cli method the only option... fortunately once you get the hang of it is an easier and more flexible option. For example, with a startup script one can add printers to post cloned workstations on boot. Word of caution, printers added via the command line can only be deleted from the command line. A printer added via cli will reappear on reboot if deleted via the GUI.

How To -

  • Login to the Workstation with an administrator account.
  • To add:
    From a cmd prompt, type the following:
    • rundll32 printui.dll,PrintUIEntry /q /ga /n\\print.williams.edu\Printer_Name
    • hit [Enter]
    • repeat and rinse as needed with other CUPS print queues
    • net stop spooler
    • hit [Enter]
    • net start spooler
    • hit [Enter]
  • To remove:
    From a cmd prompt, type the following:
    • rundll32 printui.dll,PrintUIEntry /q /gd /n\\print.williams.edu\Printer_Name
    • hit [Enter]
    • repeat and rinse as needed with other CUPS print queues
    • net stop spooler
    • hit [Enter]
    • net start spooler
    • hit [Enter]

Adding and Removing CUPS Printers to Windows Remotely

The following process demonstrates how to add a printer to a Windows workstation remotely. It uses the same commands, but requires one to specify the remote workstation by name and involves the use of an additional executable to permit you to remotely stop/start the Print Spooler service to make the printer queue visible and usable. The following documentation also differs in that assumes if you are interested in remote management you at least know to hit [Enter] after each typed command.

Prerequisites -

  • Microsoft's Sysinternal PSTool psexec tool must be placed in your Windows directory.
  • Simple File Sharing must be turned off to enable the admin share (c$) on the remote machine.
  • The remote PC's administrator username and password must be known to you.
  • You know the machine_name OR IP address of the remote computer.
  • You know the proper CUPS Printer_Name of the printer you wish to add.

How To -

  1. Establish a connection to the workstation's admin share.
    • net use \\machine_name_OR_ip\c$ /user:admin_name password
  2. To add:
    From a cmd prompt, issue the add printer command:
    • rundll32 printui.dll,PrintUIEntry /q /ga /n\\print.williams.edu\Printer_Name /c\\machine_name_OR_ip
    • repeat and rinse as needed with other CUPS print queues
  3. To remove:
    From a cmd prompt, issue the remove printer command:
    • rundll32 printui.dll,PrintUIEntry /q /gd /n\\print.williams.edu\Printer_Name /c\\machine_name_OR_ip
  4. Stop/Start the remote PC's Print Spooler service to enable the newly added printer(s)
    • psexec \\machine_name_OR_ip -s -i net stop "print spooler"
    • psexec \\machine_name_OR_ip -s -i net start "print spooler"

Via batch -

  • Download psexec (above) and place it in your Windows directory. Edit this batch and run it to automate remote printer addition.
Powered by Atlassian Confluence 2.7.1, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators