Results 1 to 7 of 7

Thread: How to Add a Default Printer Using a Visual Basic Script

  1. #1
    Join Date
    Jan 2009
    Posts
    6

    How to Add a Default Printer Using a Visual Basic Script

    Hello,

    I would like to make me a script that would automatically install 2 printers In addition I would like this script automatically sets the default printer .I also want like if the user changes the default printer, or when it closes its session and reopens the default printer initially defended the script is selected again.

    Can you help me?
    Thank you in advance

  2. #2
    Join Date
    Jan 2008
    Posts
    1,521

    Re: How to Add a Default Printer Using a Visual Basic Script

    you can use the following scripts

    :: Connection
    Rundll32 printui.dll, PrintUIEntry / in / q / n \ \ server \ printer
    :: Default
    Rundll32 printui.dll, PrintUIEntry / y / q / n \ \ server \ printer


    hope it might help you

  3. #3
    Join Date
    Jan 2009
    Posts
    6

    Re: How to Add a Default Printer Using a Visual Basic Script

    Quote Originally Posted by Modifier View Post
    you can use the following scripts

    :: Connection
    Rundll32 printui.dll, PrintUIEntry / in / q / n \ \ server \ printer
    :: Default
    Rundll32 printui.dll, PrintUIEntry / y / q / n \ \ server \ printer


    hope it might help you
    I used the following script but it does not worl

    :: Connection
    Rundll32 printui.dll, PrintUIEntry / in / q / n \ \ server \ printer
    :: Default
    Rundll32 printui.dll, PrintUIEntry / y / q / n \ \ server \ printer


    I get the message:

    Could not connect to the printer. You either entered a printer name that was incorrect or the specified printer is no longer connected to the server. Click Help for more information.
    Can you help me?

    Thank you

  4. #4
    Join Date
    Jan 2008
    Posts
    1,521

    Re: How to Add a Default Printer Using a Visual Basic Script

    Quote Originally Posted by iMacRicky View Post
    I used the following script but it does not worl

    :: Connection
    Rundll32 printui.dll, PrintUIEntry / in / q / n \ \ server \ printer
    :: Default
    Rundll32 printui.dll, PrintUIEntry / y / q / n \ \ server \ printer


    I get the message:

    Can you help me?

    Thank you

    This problem occurs because you have exceeded the allowable number of print server licenses. To resolve this problem, verify that you are not having a problem with the licensing service. To do so, temporarily disable the licensing service on the print server by following these steps:

    • Click Start, click Programs, click Administrative Tools, and then click Services.
    • Right-click License Logging Service, and then click Stop.
    • After you stop the licensing service, attempt to connect to the printer again.
    • If performing these steps corrects the problem, you may need to purchase additional licenses. To check the number of concurrent connections allowed, in Control Panel, double-click Licensing, and then click Number of concurrent connections.

  5. #5
    Join Date
    May 2008
    Posts
    115

    Re: How to Add a Default Printer Using a Visual Basic Script


  6. #6
    Join Date
    Oct 2005
    Posts
    2,393

    Re: How to Add a Default Printer Using a Visual Basic Script

    The Windows Printer Mapping on Terminal Service cannot automatically map a printer if the printer is not locally attached to an LPT, COM, or USB port.

    To map network printers for use in Windows 2000 Terminal Services and Windows NT 4.0 Terminal Server, follow these steps:

    1. In the following script, replace PrinterDriver with the name of the driver you are adding and \\Server\Printer with the name of the shared printer and server:

      Set WshNetwork = CreateObject("WScript.Network")
      PrinterPath = "\\Server\Printer"
      PrinterDriver = "PrinterDriver"
      WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver
      WshNetwork.SetDefaultPrinter "\\Server\Printer"
    2. Save and execute the script in a Visual Basic (VBS) file.


    NOTE: The parameter PrinterDriver must have the exact name of the driver as it appears in the left column of the Ntprint.inf file.

    For example, if you want to install a Cannon Bubble-Jet BJ-230, then the line in the script should read PrinterDriver = "Canon Bubble-Jet BJ-230".

    Excerpt from ntprint.inf:
    ++++++++++++++++++
    "Canon Bubble-Jet BJ-230" = CNBJ230.GPD, CanonCanon_Bubble-JeFF70,Canon_Bubble-Jet_BJ-230

    NOTE: Windows NT 4.0 Terminal Server does not have Windows Scripting Host by default. Windows Scripting Host must be installed first to execute the scripts.

  7. #7
    Join Date
    Nov 2005
    Posts
    1,323

    Re: How to Add a Default Printer Using a Visual Basic Script

    You can use con2prt

    con2prt / f ==> delete all printer connections

    Connect or disconnect a Printer

    All commands issued using this utility will affect only the user currently logged in. Con2prt is therefore ideal for managing NETWORK printer connections when used in a login script.

    Syntax
    CON2PRT /f
    CON2PRT /c \\PrintServer\PrintShare
    CON2PRT /cd \\PrintServer\PrintShare

    Key
    /f - remove all network printer connections
    /c - connect to \\PrintServer\PrintShare
    /cd - connect to and set PrintShare as the default printer

    Several switches can be combined in one command line. So you can remove all connections before adding new ones all in one command, you can only specify one default printer.

    For recent versions of Windows Microsoft now recommend the more flexible RUNDLL32 in preference to con2prt.

    The freeware utility AdPrintX is very similar to Con2Prt but has additional functionality, including compatibility with Windows 9x systems. For bulk changes don't miss the Qchange.vbs script.

Similar Threads

  1. what are Visual Basic IDE?
    By Naresh Modi in forum Software Development
    Replies: 2
    Last Post: 06-03-2009, 09:49 AM
  2. Is GUI same like Visual Basic ?
    By Caesar in forum Software Development
    Replies: 2
    Last Post: 02-03-2009, 01:32 PM
  3. Visual Basic 2005 or Visual Basic 6
    By Aasha in forum Software Development
    Replies: 5
    Last Post: 15-01-2009, 06:56 PM
  4. Visual Basic on Xbox 360
    By amadeo in forum Software Development
    Replies: 4
    Last Post: 16-09-2008, 02:11 PM
  5. Visual Basic on LAN
    By djbbenn in forum Software Development
    Replies: 2
    Last Post: 05-08-2008, 02:15 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,584,881.15080 seconds with 17 queries