Home NT WSH
WshNetwork.AddPrinterConnection

Echo a text string to the screen (cscript) or a dialogue box (wscript)

Syntax 
      myObject.AddPrinterConnection(strLocalName, 
                     strRemoteName[,bUpdateProfile][,strUser][,strPassword]

Arguments:

   strLocalName  :  Local printer Name (String value) 
   
   strRemoteName : Remote printer Name (String value) 

   
   bUpdateProfile : Indicate whether the printer mapping 
                    is stored in the current user's profile.
                    Boolean value  
                    If TRUE the mapping is stored in the user profile. 
                    default = false.
   
   strUser       : The user name. (if using a different profile)
                   Optional. 
   
   strPassword   : The user password. (if using a different profile)
                   Optional. 
   
Example
connecting a network printer to LPT1.

Set WshNetwork = WScript.CreateObject("WScript.Network") 
WshNetwork.AddPrinterConnection "LPT1", "\\Server\Print1"

The AddPrinterConnection method adds a network printer to an MS-DOS printer port, such as LPT1.
To add a remote Windows-based printer connection, use the AddWindowsPrinterConnection method.

"Modern art is what happens when painters stop-looking at girls and persuade themselves that they have a better idea" - John Ciardi

Related commands:

add Network printer - WshNetwork.AddWindowsPrinterConnection

Equivalent Windows NT commands:

NET VIEW - to view a list of printers
NET PRINT - View and Delete print jobs
PRNCNFG - Display, configure or rename a printer
PRNDRVR - Add, delete or list printer drivers.
PRNMNGR - Add, delete, or list printers / connections, set the default printer.



Back to the Top

Simon Sheppard
SS64.com