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. 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], 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 }
     
    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 :)
     
    Steffen Brandsborg, Mar 11, 2010
    #4
    1. Advertisements

Ask a Question

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.