SAMPLE: Rename Printers via Windows Script Host (300518)



The information in this article applies to:

  • Microsoft Windows Script Host 1.0
  • Microsoft Windows Script Host 2.0

This article was previously published under Q300518

SUMMARY

Due to limitations in Windows Script Host, there is no method to rename printers once they have been created. For Windows 95/Windows 98 clients the problem is exacerbated because the AddWindowsPrinterConnection method uses the printer driver name for the printer name. This causes a problem if more than one printer that uses the same driver must be added. This article provides source code (Renprinter_source.exe) for a sample Win32 dynamic link library (DLL) called Renprinter.dll that implements the following Win32 APIs:

OpenPrinter
GetPrinter
SetPrinter
ClosePrinter

This DLL can be called from script, and a sample is included with the source.

MORE INFORMATION

The following file is available for download from the Microsoft Download Center:
Release Date: JUN-05-2001

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. The Renprinter_source.exe file contains the following files:

Renprinter_source.exe10KB
Renprinter.cpp4KB
Renprinter.def1KB
Renprinter.dsp5KB
Renprinter.dsw1KB
Renprinter.ncb49KB
Renprinter.opt48KB
Renprinter.plg2KB
Renprinter.vbs1KB

Modification Type:MinorLast Reviewed:8/9/2004
Keywords:kbdownload kbDSWManage2003Swept kbfile kbhowto KB300518 kbAudDeveloper