Discussion:
Map printer connection
(too old to reply)
Steffen Brandsborg
2010-02-22 08:30:06 UTC
Permalink
Hi all,

Im trying to map a network shared printer to a LPT port using a logon script
in group policy.

The script works just fine when i launch the script directly from a logged
in user, but fails when i use group policy.

my script:

Set wshNetwork = WScript.CreateObject("WScript.Network")
Set wshNetwork = CreateObject("WScript.Network")

wshNetwork.AddPrinterConnection "LPT2", "\\SERVER\Printer"
Richard Mueller [MVP]
2010-02-22 16:05:39 UTC
Permalink
Post by Steffen Brandsborg
Hi all,
Im trying to map a network shared printer to a LPT port using a logon script
in group policy.
The script works just fine when i launch the script directly from a logged
in user, but fails when i use group policy.
Set wshNetwork = WScript.CreateObject("WScript.Network")
Set wshNetwork = CreateObject("WScript.Network")
wshNetwork.AddPrinterConnection "LPT2", "\\SERVER\Printer"
The script looks fine (although you can skip the first "Set wshNetwork"
statement). I suspect the logon script is not running. See #8 in this link
for the method I use to configure logon scripts in Group Policy:

http://www.rlmueller.net/LogonScriptFAQ.htm

In particular, I like to paste the script into the "Show Files" dialog. To
check if your script is running, perhaps add a statement to the script to
map a drive letter to a shared folder (which the user has access to).
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
David H. Lipman
2010-02-23 00:39:57 UTC
Permalink
From: "Steffen Brandsborg" <no-***@s.com>

| Hi all,

| Im trying to map a network shared printer to a LPT port using a logon script
| in group policy.

| The script works just fine when i launch the script directly from a logged
| in user, but fails when i use group policy.

| my script:

| Set wshNetwork = WScript.CreateObject("WScript.Network")
| Set wshNetwork = CreateObject("WScript.Network")

| wshNetwork.AddPrinterConnection "LPT2", "\\SERVER\Printer"



All you need is ONE command line..

net use lpt2: \\server\printer

{ no fancy programming needed }
--
Dave
http://www.claymania.com/removal-trojan-adware.html
Multi-AV - http://www.pctipp.ch/downloads/dl/35905.asp
Steffen Brandsborg
2010-03-11 13:15:26 UTC
Permalink
Thanks for the help guys,

I use the net use command. easy stuff :)

i have rated both replys as useful :)
Post by David H. Lipman
| Hi all,
| Im trying to map a network shared printer to a LPT port using a logon script
| in group policy.
| The script works just fine when i launch the script directly from a logged
| in user, but fails when i use group policy.
| Set wshNetwork = WScript.CreateObject("WScript.Network")
| Set wshNetwork = CreateObject("WScript.Network")
| wshNetwork.AddPrinterConnection "LPT2", "\\SERVER\Printer"
All you need is ONE command line..
net use lpt2: \\server\printer
{ no fancy programming needed }
--
Dave
http://www.claymania.com/removal-trojan-adware.html
Multi-AV - http://www.pctipp.ch/downloads/dl/35905.asp
Loading...