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. Kitkatninja
    Highly Decorated Member Award 500 Likes Award

    Kitkatninja aka me, myself & I Moderator

    11,143
    559
    383
    This may help you:

    Code:
    Set oNet = WScript.CreateObject("WScript.Network") 
    oNet.AddPrinterConnection("Printer1","\\server\printer",False,"domain\username","Password") 
    -Ken
     
    Certifications: MSc, PGDip, PGCert, BSc, HNC, LCGI, MBCS CITP, MCP, MCSA, MCSE, MCE, A+, N+, S+, Server+
    WIP: MSc Cyber Security
  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
    172
    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...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.