Hi all,

How can I share a printer via script?

I'm running Win 2003 server.

Pls help!



/JeHo

Re: Share a printer.. by jcochran

jcochran
Wed Sep 17 14:00:12 CDT 2003

On Wed, 17 Sep 2003 19:37:32 +0200, "JeHo" <jeho@bredband.net> wrote:

>How can I share a printer via script?

Not exactly sure what you're asking, but if you have the printer
configured on the server, you can map it at the client via WSH. Try
looking at the AddWindowsPrinterConnection method for the Network
object, or AddNetworkPrinterConnection perhaps.

Something like:

----------------------------
Set wshNetwork = WScript.CreateObject("Wscript.Network")
wshNetwork.AddWindowsPrinterConnection "\\server\printername"
----------------------------

Jeff

Re: Share a printer.. by JeHo

JeHo
Wed Sep 17 14:19:00 CDT 2003

What I'm trying to do is to share my auto created printer in TS session in
Win 2003 server. Then I'm remap the shared printer to LPT so I can print
from my DOS app. to my local client printer.

I hop it works...

Anyone have a better solution to print from DOS to LPT1 in a TS session?



/JeHo





"Jeff Cochran" <jcochran.nospam@naplesgov.com> wrote in message
news:3f71ae88.1318106046@msnews.microsoft.com...
> On Wed, 17 Sep 2003 19:37:32 +0200, "JeHo" <jeho@bredband.net> wrote:
>
> >How can I share a printer via script?
>
> Not exactly sure what you're asking, but if you have the printer
> configured on the server, you can map it at the client via WSH. Try
> looking at the AddWindowsPrinterConnection method for the Network
> object, or AddNetworkPrinterConnection perhaps.
>
> Something like:
>
> ----------------------------
> Set wshNetwork = WScript.CreateObject("Wscript.Network")
> wshNetwork.AddWindowsPrinterConnection "\\server\printername"
> ----------------------------
>
> Jeff