Map printer connection

Discussion in 'Scripting' started by Steffen Brandsborg, Feb 22, 2010.

  1. 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"
     
    Steffen Brandsborg, Feb 22, 2010
    #1
    1. Advertisements

  2. "Steffen Brandsborg" <> wrote in message
    news:ulDt%...
    > 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"
    >


    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
    --
     
    Richard Mueller [MVP], Feb 22, 2010
    #2
    1. Advertisements

  3. From: "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.

    | 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
     
    David H. Lipman, Feb 23, 2010
    #3
  4. Thanks for the help guys,

    I use the net use command. easy stuff :)

    i have rated both replys as useful :)

    "David H. Lipman" <DLipman~nospam~@Verizon.Net> wrote in message
    news:...
    > From: "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.
    >
    > | 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, Mar 11, 2010
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. scottpen

    View Full Map for Network Map

    scottpen, Feb 27, 2007, in forum: Windows Vista Networking
    Replies:
    30
    Views:
    1,162
    Bob27519
    Feb 21, 2009
  2. NCS

    can't map to a network drive but can map to others

    NCS, Oct 4, 2007, in forum: Windows Vista Networking
    Replies:
    2
    Views:
    611
  3. Jack-MVP
    Replies:
    0
    Views:
    848
    Jack-MVP
    Mar 9, 2009
  4. Edward
    Replies:
    0
    Views:
    1,282
    Edward
    Jun 11, 2004
  5. Peter Parker

    Wireless Printer doesn't map

    Peter Parker, Jan 4, 2005, in forum: Windows Server
    Replies:
    7
    Views:
    428
    Peter Parker
    Jan 10, 2005
  6. Billy Leung

    Can't map local printer to terminal

    Billy Leung, Jul 22, 2005, in forum: Windows Server
    Replies:
    0
    Views:
    435
    Billy Leung
    Jul 22, 2005
  7. Billy Leung

    Map Printer in Remote Desktop Connection

    Billy Leung, Jul 22, 2005, in forum: Windows Small Business Server
    Replies:
    3
    Views:
    635
    Crina Li
    Jul 25, 2005
  8. Craig
    Replies:
    1
    Views:
    314
    Tom Lavedas
    Oct 5, 2004
Loading...