Share a printer from the command line

  • Thread starter Thread starter Daniel Wyness
  • Start date Start date
D

Daniel Wyness

Hello.

Can anyone help with the following?

I need to share an existing printer from the command line in Windows 2000?
Is there a command or utility to do this?

I have tried every combination of NET SHARE and rundll32
printui.dll,PrintUIEntry commands I can think of.

NET SHARE doesn't seem to be able to do printers, and there are a few
references to sharing in the rundll32 printui.dll,PrintUIEntry documentation
but I can't seem to specify the sharename or do it without installing a
printer at the same time (my printers already exist)

Any help appreciated.
 
Daniel Wyness said:
Hello.

Can anyone help with the following?

I need to share an existing printer from the command line in Windows 2000?
Is there a command or utility to do this?

I have tried every combination of NET SHARE and rundll32
printui.dll,PrintUIEntry commands I can think of.

NET SHARE doesn't seem to be able to do printers, and there are a few
references to sharing in the rundll32 printui.dll,PrintUIEntry documentation
but I can't seem to specify the sharename or do it without installing a
printer at the same time (my printers already exist)

Any help appreciated.

Here are a few suggestions, all of them untried:

http://support.microsoft.com/default.aspx?scid=kb;en-us;189105

Printer.vbs
on error resume next
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\printserver\printershare1"
WshNetwork.AddWindowsPrinterConnection "\\printserver\printershare2"
WshNetwork.AddWindowsPrinterConnection "\\printserver\printershare3"
WshNetwork.SetDefaultPrinter "\\printserver\printershare1"
Set WshNetwork = nothing

rundll32 printui.dll,PrintUIEntry /ia /c\\SERVER /m "AGFA-AccuSet v52.3" /h
"Intel"
rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /c\\SERVER /f
"%windir%\inf\ntprint.inf" /r "lpt1:" /m "AGFA-AccuSet v52.3"

Install a printer for ***all*** users on a Win2000/XP PC:
rundll32 printui.dll PrintUIEntry /ga /n \\server\printername
 
Hello

I've managed to answer my own question. I've posted the solution below in
case anyone finds it useful. Thanks for the help 'Pegasus'. Very much
appreciated.

Dan

rundll32 printui.dll,PrintUIEntry /Xs /n "hp deskjet 5100 series" Sharename
"PR1"
rundll32 printui.dll,PrintUIEntry /q /Xs /n "hp deskjet 5100 series" Comment
"BackOffice Printer"
rundll32 printui.dll,PrintUIEntry /q /Xs /n "hp deskjet 5100 series"
Location "Remote Office"
rundll32 printui.dll,PrintUIEntry /q /Xs /n "hp deskjet 5100 series"
Attributes Shared
 
Back
Top