Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











Method:  WshNetwork.AddWindowsPrinterConnection

Win 95/98: WshNetwork.AddWindowsPrinterConnection strPrinterPath, strDriverName [,strPort]
 
Win2000/NT: WshNetwork.AddWindowsPrinterConnection strPrinterPath

There are two prototypes of the AddWindowsPrinterConnection method, one for Windows 95/98, and one for Windows NT/2000. This method essentially emulates the process of adding network printer connections via Control Panel/Printers. When using this method on Windows 95/98 machines, the printer driver must already be installed or this method will fail. Unlike the AddPrinterConnection method, this method does not require a port to be specified explicitly. The default port is LPT1.

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

Code:
' On Windows 95/98 Machines:
strPrinterPath = "\\Server\LaserJet"
strDriverName = "HP LaserJet 4/4M Plus PS 600"
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection strPrinterPath, strDriverName


' On Windows NT/2000 Machines:
strPrinterPath = "\\Server\LaserJet"
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection strPrinterPath

 


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