Solved

VB Scripting - Printers / Netowrk objects

Posted on 2004-10-28
186 Views
Last Modified: 2010-05-02
I need some help with a VB Script (used for Terminal Services users)

I've done scripts like this;

dim met
set net=CreateObject(WScript.Network")
net.AddWindowsPrinterConnection "\\server\printer", "PName"

- and -

net.SetDefaultPrinter "\\server\printer"

but what if the printer is not a shared device ?  e.g. - an network printer with a NIC (IP Port on client) ?
how do you specify this printer using "net.SetDefaultPrinter" ?

couldnt find specific info on this.
0
Question by:BrianBaley
    2 Comments
     
    LVL 16

    Accepted Solution

    by:
    Try using net.AddWindowsPrinterConnection "\\mydomain\printername"

    Most networked printers are installed with a machine name...

    J.
    0
     
    LVL 16

    Expert Comment

    by:jimbobmcgee
    I believe you can also use \\aaa.bbb.ccc.ddd (the printer IP) as a UNC, if it is fixed, too.

    J.
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

    913 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now