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. 

WshNetwork.AddWindowsPrinterConnection

MAP a Network (remote) Printer
Syntax
myObject.AddWindowsPrinterConnection(strLocalName UNC_Printer_Name)


Example

Dim net
Set net = CreateObject("WScript.Network")
net.AddWindowsPrinterConnection "\\ServerName\PrinterName"

or
net.AddWindowsPrinterConnection "LPT1", "\\ServerName\PrinterName"

Make a Free Website with Yola.