Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 17-01-2009
Member
 
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
Reply With Quote
  #2  
Old 17-01-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
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
Reply With Quote
  #3  
Old 17-01-2009
Member
 
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:

Quote:
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
Reply With Quote
  #4  
Old 17-01-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
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.
Reply With Quote
  #5  
Old 17-01-2009
Member
 
Join Date: May 2008
Posts: 115
Re: How to Add a Default Printer Using a Visual Basic Script

Have a look at similar thread

http://forums.techarena.in/xp-print-fax/937795.htm
Reply With Quote
  #6  
Old 17-01-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
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:

    Quote:
    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:
Quote:
++++++++++++++++++
"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.
Reply With Quote
  #7  
Old 17-01-2009
Member
 
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to Add a Default Printer Using a Visual Basic Script"
Thread Thread Starter Forum Replies Last Post
what are Visual Basic IDE? Naresh Modi Software Development 2 06-03-2009 09:49 AM
Is GUI same like Visual Basic ? Caesar Software Development 2 02-03-2009 01:32 PM
Visual Basic 2005 or Visual Basic 6 Aasha Software Development 5 15-01-2009 06:56 PM
Visual Basic on Xbox 360 amadeo Software Development 4 16-09-2008 02:11 PM
Visual Basic on LAN djbbenn Software Development 2 05-08-2008 02:15 PM


All times are GMT +5.5. The time now is 08:40 AM.