Method:  WshNetwork.AddPrinterConnection

WshNetwork.AddPrinterConnection strLocalName, strRemoteName [,bUpdateProfile] [,strUser] [,strPassword]

The AddPrinterConnection method maps a remote printer specified by strRemoteName to the local resource name strLocalName. If the optional parameter bUpdateProfile is set to True (default is False), the mapping will be saved to current user's profile. The parameters strUser and strPassword can be used to connect to remote printers using someone else's credentials.

The following VBScript code connects the network printer \\Server\LaserJet to LPT1.

Code:
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddPrinterConnection "LPT1", "\\Server\LaserJet"


Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information