.AddPrinterConnection

Add a printer connection.

Syntax 
 objNetwork.AddPrinterConnection(strLocalName, 
 strRemoteName[,bUpdateProfile][,strUser][,strPassword]
Key
 objNetwork : A WScript.network object
 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. 

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.

Examples

' Connect a network printer to LPT1.
Set objNetwork = WScript.CreateObject("WScript.Network") 
objNetwork.AddPrinterConnection "LPT1", "\\Server\Print1"

"Pay attention. It’s all about paying attention. attention is vitality.
It connects you with others. It makes you eager. stay eager" ~ Susan Sontag

Related VBScript commands

Add Network printer - .AddWindowsPrinterConnection
printcon.vbs - change a Print connection to a different Queue/Server.
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.
Network Printing - Advice & Tips.

(追記) (追記ここまで)
Copyright © 1999-2026 SS64.com
Some rights reserved

AltStyle によって変換されたページ (->オリジナル) /