Discussion Locked

Add/del printer w/no user intervention

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Issue: How do I remove and add network printers with no user intervention AND have it apply to all current profiles. Further, I would like to write a script that will check what printers are currently installed and replace those with a new printer (network queues) ie: read registry -> replace \\server1\printer1 with \\server2\printer3. I would also need to to determine which printer is default before replacing.

Info: 000 pc network. Assume win2k clients and win2k advanced svr.

I currently use the printui.dll to add/remove printers but that does not affect current profiles.

5 replies

by arne.tredal

The script language KiXtart (http://www.kixtart.org/)
has built-in functions to do this.

- ADDPRINTERCONNECTION
- SETDEFAULTPRINTER
- DELPRINTERCONNECTION

Current printerconnections can be read from registry; "HKEY_CURRENT_USER\Printers\Connections\"

Current default printer can be read from registry;
"HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows\"

by eric.gustafson

Splitting points. Both decent answers with pro's and cons. Neither really appears to address printers for all profiles, just the current profile. Kixstart however has opened up some easier/newer possiblities systemwide. Thanks!

by mikenac

I recommend that you use a VBScript or JScript logon script to do this. The Windows Scripting Host provides built-in object oriented functions for this purpose.

The WshNetwork object allows you to:

Add connections
Delete connections
Enumerate connections

http://msdn.microsoft.com/scripting

Here is an example:

'VBScript Example

dim wshNetwork
dim strPrinterPath

strPrinterPath = "\\Servername\ShareName"

set wshNetwork = WScript.CreateObject("WScript.Network")

wshNetwork.AddWindowsPrinterConnection strPrinterPath

by eric.gustafson

Splitting points. Both decent answers with pro's and cons. Neither really appears to address printers for all profiles, just the current profile. Kixstart however has opened up some easier/newer possiblities systemwide. Thanks!

This discussion is closed to new replies.