Microsoft® Windows® Script Host
AddPrinterConnection Method
WSH Reference
Version 1

See Also                      Applies To


Description
Maps the remote printer specified by strRemoteName to the local resource name strLocalName.
Syntax
object.AddPrinterConnection strLocalName, strRemoteName[,bUpdateProfile][,strUser][,strPassword]
Parameters
Part Description
object WshNetwork object.
strLocalName Local printer resource.
strRemoteName Remote printer resource.
bUpdateProfile Optional. If bUpdateProfile is supplied and its value is TRUE, this mapping is stored in the user profile.
strUser Optional. If you are mapping a remote printer using the credentials of someone other than current user, you can specify strUser and strPassword.
strPassword Optional. If you are mapping a remote printer using the credentials of someone other than current user, you can specify strUser and strPassword.
Example
The following example uses the AddPrinterConnection method to connect a network printer to LPT1.
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddPrinterConnection "LPT1", "\\Server\Print1"