You need to share a printer physically attached to a remote machine and want to do this remotely from the command-line.
- 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 printer1above 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.