-
Syntax:
- WshNetwork.AddPrinterConnection (strLocalName, strRemoteName [,bUpdateProfile] [,strUser]
[,strPassword])
- strLocalName
- Receives the local resource name to which the remote printer specified by strRemoteName will be mapped.
- strRemoteName
- Receives the remote printer name that will be mapped to the resource in strLocalName.
- bUpdateProfile
- This optional printer is should be set to True if the mapping is to be saved to the current user's profile.
- strUser
- When combined with strPassword, this parameter can be used to connect to a remote printer using someone else's credentials.
- strPassword
- When combined with strUser this parameter can be used to connect to a remote printer using someone else's credentials.
The
AddPrinterConnection method makes a connection to a remote
printer.
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.
Examples
Code:
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddPrinterConnection "LPT1", "\\Server\LaserJet"Explanation:
This VBScript code connects the network printer
\\Server\LaserJet to LPT1.
Language(s):
VBScript