1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Problem Need a script to map a printer from workgroup server

Discussion in 'Scripting & Programming' started by Bambino1506, Aug 17, 2010.

  1. Bambino1506

    Bambino1506 Megabyte Poster

    594
    8
    64
    Guys, I have been struggling with this for most of this afternoon and would really appreciate some advice please.

    I need to create a script, .vbs .bat. .kix don't care which, that can map a printer on a server that is not part of our domain and is part of a workgroup.

    I need to be able to specify the admin credentials on the workgroup server in the script so that it will map the printer.

    Have tried this .vbs, but not working

    Set objNetwork = WScript.CreateObject("WScript.Network")
    objNetwork.AddWindowsPrinterConnection "\\server\printer", "username", "password"
     
    Certifications: MCP,MCDST,MCSA
    WIP: CCA
  2. wagnerk
    Highly Decorated Member Award

    wagnerk aka kitkatninja Moderator

    10,831
    357
    341
    This may help you:

    Code:
    Set oNet = WScript.CreateObject("WScript.Network") 
    oNet.AddPrinterConnection("Printer1","\\server\printer",False,"domain\username","Password") 
    -Ken
     
    Certifications: CITP, PGCert, BSc, HNC, LCGI, PTLLS, MCT, MCITP, MCTS, MCSE, MCSA:M, MCSA, MCDST, MCP, MTA, MCAS, MOS (Master), A+, N+, S+, ACA, VCA, etc... & 2nd Degree Black Belt
    WIP: PGDip
  3. Bambino1506

    Bambino1506 Megabyte Poster

    594
    8
    64
    Thanks Ken !!
    I knew it would be something simple. Will give that a try tomorrow.
     
    Certifications: MCP,MCDST,MCSA
    WIP: CCA
  4. Simonvm

    Simonvm Kilobyte Poster

    472
    13
    41
    Last edited: Aug 17, 2010
    Certifications: MCITP: EST, MCDST, MCTS, A+, N+, CCNP, CCNA Wireless
  5. Bambino1506

    Bambino1506 Megabyte Poster

    594
    8
    64
    Getting an error "Cannot use parentheses when calling a sub"

    Line 2, Char 92

    have tried removing brackets, any ideas ?
     
    Certifications: MCP,MCDST,MCSA
    WIP: CCA
  6. Fergal1982

    Fergal1982 Petabyte Poster

    4,196
    171
    211
    What error did you get when you removed the parentheses on line 2?
     
    Certifications: ITIL Foundation; MCTS: Visual Studio Team Foundation Server 2010, Administration
    WIP: None at present

Share This Page

Loading...