Share a Windows Printer from the Command Line


We’ll be using pstools, rundll, and WMIC to do this.

Download the PsTools suite and extract Open a CMD window and change directory to the extracted PsTools location Start a CMD session on the remote machine using psexec:

    > psexec \remote-machine cmd
After connecting, list the printers available on the machine:
    > wmic printer get name


If you want to make printer1 above shared:

    > rundll32 printui.dll,PrintUIEntry /Xs /n "printer1" Sharename "Printer1"
    > rundll32 printui.dll,PrintUIEntry /q /Xs /n "printer1" Attributes Shared
Confirm the printer is available by going to \remote-machine in Windows Explorer; you should see the printer available now.

Last modified:: 2016/10/06 15:22